<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use ImovelZapAi\Organizations\Infrastructure\Persistence\Eloquent\SubscriptionPlanModel;

/**
 * @extends Factory<SubscriptionPlanModel>
 */
class SubscriptionPlanFactory extends Factory
{
    protected $model = SubscriptionPlanModel::class;

    /**
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'code' => 'plan-'.fake()->unique()->numerify('####'),
            'name' => fake()->words(2, true),
            'price_monthly_cents' => 9700,
            'price_yearly_cents' => 97000,
            'sort_order' => 100,
            'max_users' => 5,
            'max_properties' => 100,
            'max_whatsapp_messages_month' => 5000,
            'features' => ['whatsapp', 'portal'],
            'is_active' => true,
        ];
    }

    public function solo(): static
    {
        return $this->state(fn (): array => [
            'code' => 'solo',
            'name' => 'Solo',
            'max_users' => 1,
            'max_properties' => 200,
            'max_whatsapp_messages_month' => 2000,
            'features' => ['whatsapp', 'portal', 'ai_basic'],
        ]);
    }

    public function start(): static
    {
        return $this->state(fn (): array => [
            'code' => 'start',
            'name' => 'Start',
            'max_users' => 5,
            'max_properties' => 500,
            'max_whatsapp_messages_month' => 10000,
            'features' => ['whatsapp', 'portal', 'ai_basic', 'manager_dashboard'],
        ]);
    }

    /** @deprecated use start() */
    public function agency(): static
    {
        return $this->start();
    }
}
