<?php

declare(strict_types=1);

namespace ImovelZapAi\Publishing\Infrastructure\Persistence\Eloquent;

use Database\Factories\TenantPublishingConfigFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use ImovelZapAi\Publishing\Domain\Enums\TenantPublishingPlan;
use ImovelZapAi\Publishing\Domain\Enums\TenantPublishingStatus;
use ImovelZapAi\Shared\Infrastructure\Persistence\Concerns\BelongsToTenant;
use ImovelZapAi\Shared\Infrastructure\Persistence\Concerns\HasUuidPrimaryKey;

class TenantPublishingConfigModel extends Model
{
    use BelongsToTenant;

    /** @use HasFactory<TenantPublishingConfigFactory> */
    use HasFactory;
    use HasUuidPrimaryKey;

    protected $table = 'tenant_publishing_configs';

    /** @var list<string> */
    protected $fillable = [
        'tenant_id',
        'company_name',
        'logo_url',
        'email',
        'telephone',
        'publishing_status',
        'plan',
        'channel_pro_enabled',
    ];

    /** @return array<string, string> */
    protected function casts(): array
    {
        return [
            'publishing_status' => TenantPublishingStatus::class,
            'plan' => TenantPublishingPlan::class,
            'channel_pro_enabled' => 'boolean',
        ];
    }

    protected static function newFactory(): TenantPublishingConfigFactory
    {
        return TenantPublishingConfigFactory::new();
    }
}
