<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Concerns\HasUuids;

class Country extends Model
{
    use HasFactory, HasUuids;

    protected $table = 'countries';

    const CREATED_AT = 'createDateTime';
    const UPDATED_AT = 'updateDateTime';

    protected $primaryKey = 'id';
    public $incrementing = false;
    protected $keyType = 'string';

    protected $fillable = [
        'nameFa',
        'nameEn',
        'code',
        'isActive'
    ];

    protected $casts = [
        'isActive' => 'boolean',
        'createDateTime' => 'datetime',
        'updateDateTime' => 'datetime'
    ];

    public function provinces()
    {
        return $this->hasMany(Province::class, 'countryId', 'id');
    }
}
