<?php

namespace App\Domain\Shared\Models;

use App\Domain\Identity\Models\Branch;
use App\Domain\Shared\Traits\HasUuid;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class Academy extends Model
{
    use HasUuid, SoftDeletes;

    protected $fillable = [
        'name',
        'name_ar',
        'slug',
        'email',
        'phone',
        'address',
        'logo_path',
        'currency',
        'timezone',
        'locale',
        'settings',
        'branding_version',
        'status',
    ];

    protected $casts = [
        'settings' => 'array',
        'branding_version' => 'integer',
    ];

    public function users(): HasMany
    {
        return $this->hasMany(User::class, 'academy_id');
    }

    public function branches(): HasMany
    {
        return $this->hasMany(Branch::class, 'academy_id');
    }
}
