<?php

namespace App\Models\Setting;

use App\Models\Communication\PhoneNumberType;
use Illuminate\Database\Eloquent\Model;

class PhoneNumber extends Model {
    protected $table = 'phone_numbers';

    protected $fillable = [
        'phone_number_type_id',
        'label',
        'phone_number',
        'normalized_phone_number',
        'provider',
        'twilio_account_sid',
        'twilio_subaccount_sid',
        'twilio_phone_number_sid',
        'is_active',
        'is_primary',
        'capabilities',
        'meta',
    ];

    protected $casts = [
        'is_active'    => 'boolean',
        'is_primary'   => 'boolean',
        'capabilities' => 'array',
        'meta'         => 'array',
    ];

    public function type() {
        return $this->belongsTo(PhoneNumberType::class, 'phone_number_type_id');
    }
}
