<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('subscriptions', function (Blueprint $table) {
            $table->decimal('total_premium', 12, 2)
                  ->nullable()
                  ->after('premium_paisa')
                  ->comment('Sum of all members premiums (self + dependents)');

            $table->decimal('total_premium_paisa', 12, 0)
                  ->nullable()
                  ->after('total_premium')
                  ->comment('Total premium in paisa sent to Easypaisa');

            $table->integer('members_count')
                  ->default(1)
                  ->after('total_premium_paisa')
                  ->comment('Total insured members including self');
        });
    }

    public function down(): void
    {
        Schema::table('subscriptions', function (Blueprint $table) {
            $table->dropColumn(['total_premium', 'total_premium_paisa', 'members_count']);
        });
    }
};