<?php

namespace App\Models;

use App\Casts\EmailAddress;
use App\Casts\PhoneNumber;
use Illuminate\Database\Eloquent\Model;

class RedressScheme extends Model
{
    protected $table = 'redress_scheme';

    protected $fillable = [
        'name',
        'contact_name',
        'email',
        'phone',
    ];

    protected $casts = [
        'email' => EmailAddress::class,
        'phone' => PhoneNumber::class,
    ];

    public function getEmailAddressAttribute(): mixed
    {
        return $this->email;
    }

    public function getDisplayNameAttribute(): string
    {
        return $this->contact_name ?? $this->name;
    }
}
