<?php

namespace App\Models;

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

class MaidLink extends Model
{
    use HasFactory;

    protected $fillable = [
        'nationality_id',
        'meta_title',
        'meta_description',
        'meta_keywords',
        'h1',
        'title',
        'slug',
        'content_en',
        'content_ar',
        'image',
    ];

    public const NATIONALITIES = [
        1 => 'Ethiopia',
        2 => 'Uganda',
        3 => 'Philipine',
    ];

    public function getNationalityNameAttribute(): string
    {
        return self::NATIONALITIES[$this->nationality_id] ?? 'Unknown';
    }

    public function getImageUrlAttribute(): ?string
    {
        return $this->image ? asset('storage/' . $this->image) : null;
    }

    public function getRouteKeyName(): string
    {
        return 'id';
    }
}