<?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',
        'logo_path',
        'currency',
        'timezone',
        'locale',
        'settings',
        'status',
    ];

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

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

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