<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Model;

class Dealer extends Model
{
    use HasFactory;
    use SoftDeletes;

    protected $fillable = [
        'name',
        'domain',
        'is_active',
        'provisioning_status',
    ];

    protected $casts = [
        'is_default' => 'bool',
        'is_active' => 'bool',
        'provisioned_at' => 'datetime',
        'baseline_last_applied_at' => 'datetime',
    ];

    public function departments(): HasMany
    {
        return $this->hasMany(Department::class);
    }

    public function provisioningRuns(): HasMany
    {
        return $this->hasMany(DealerProvisioningRun::class);
    }
}
