<?php

namespace App\Models;

use CodeIgniter\Model;
use App\Models\_query_reader;

class _carrier extends Model
{
    #Constructor to set some default values at class load
    public function __construct()
    {
        // parent::__construct();
        $this->query_reader = new _query_reader();
    }

    # Get the email domain of a carrier for use in sending an email-to-sms message
    public function get_email_domain($telephone)
    {
        $domain = $this->query_reader->get_row_as_array('get_carrier_email_domain', array('number_stub'=>substr($telephone, 0, 3) ));
        return !empty($domain['email_domain'])? $domain['email_domain']: '';
    }
}
