<?php

namespace App\Models;

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

class ContactMessage extends Model
{
    use HasFactory;

    protected $fillable = [
        'name', 'email', 'phone', 'subject', 'message', 'status', 'ip_address',
    ];

    public function scopeUnread($q) { return $q->where('status', 'new'); }

    public function statusLabel(): string
    {
        return match ($this->status) {
            'new'      => 'Шинэ',
            'read'     => 'Уншсан',
            'replied'  => 'Хариулсан',
            'archived' => 'Архивласан',
            default    => $this->status,
        };
    }
}
