<?php

class CADatabase extends Model
{
  public function __construct($id)
  {
    parent::__construct($id);
  }


  /**
   * Get the call sign of the station
   *
   * @return string (Call sign of the licensee)
   */
  public function getCallSign()
  {
    return trim($this->callSign);
  }


  /**
   * Get the license class from the Canadian License file for the station
   *
   * @return array (false on no records found)
   */
  public function getLicenseClass()
  {
    if ($this->advancedQualification == 'D')
    {
      return 'Advanced';
    }
    else if ($this->basicWithHonors == 'E')
    {
      return 'Basic w/ Honors';
    }
    else if ($this->basicQualification == 'E')
    {
      return 'Basic';
    }
  }


  /**
   * Get the license status from the Canadian database for the station
   *
   * @return boolean (true if vanity call else false)
   */
  public function isClub()
  {
    return $this->clubName1 != null ? true : false;
  }


  /**
   * Get the license qualification codes from the Canadian database for the station
   *
   * @return boolean (true if vanity call else false)
   */
  public function getQualifications()
  {
    return
      $this->basicQualification
      .$this->fiveWpmQualification
      .$this->twelveWpmQualification
      .$this->advancedQualification
      .$this->basicWithHonors;
  }
}
?>
