<?php

namespace Database\Factories;

use App\Models\Package;
use App\Models\Tenant;
use App\Models\TenantPackage;
use Illuminate\Database\Eloquent\Factories\Factory;

class TenantPackageFactory extends Factory
{
    protected $model = TenantPackage::class;

    public function definition(): array
    {
        return [
            'tenant_id' => Tenant::factory(),
            'package_id' => Package::factory(),
            'price' => $this->faker->randomFloat(2, 0, 500),
            'purchased_at' => now(),
            'expires_at' => now()->addYear(),
            'used_events' => 0,
            'active' => true,
        ];
    }

    public function inactive(): self
    {
        return $this->state(fn () => ['active' => false]);
    }
}
