<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
 * Free plan: enable all features (patient_records, services, sms_panel, insurance).
 * Free plan's only limitation is the number of secretaries (max_secretaries).
 */
final class Version20260705070546 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Free plan gets all features enabled; only secretary count is limited';
    }

    public function up(Schema $schema): void
    {
        $now = time();
        $this->addSql(
            "UPDATE subscription_plans
             SET features = '{\"patient_records\":true,\"services\":true,\"sms_panel\":true,\"insurance\":true}',
                 active = 1,
                 updated_at = {$now}
             WHERE name = 'free'"
        );
    }

    public function down(Schema $schema): void
    {
        $now = time();
        $this->addSql(
            "UPDATE subscription_plans
             SET features = '{\"patient_records\":false,\"services\":false,\"sms_panel\":false}',
                 updated_at = {$now}
             WHERE name = 'free'"
        );
    }
}
