<?php

class DNSRecord extends PhonalisaRecord
{

    public $type;
    public $host;
    public $prio;
    public $name;
    public $dnsZone;
    public $position;

    public static function myAttributes()
    {
        return array(
            'type' => 'type',
            'host' => 'host',
            'prio' => 'prio',
            'name' => 'name',
            'dnsZone' => 'dnsZone',
            'position' => 'position'
        );
    }

    /**
     * Returns the static model of the specified AR class.
     * @param string $className active record class name.
     * @return Job the static model class
     */
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules()
    {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            // The following rule is used by search().
            // Please remove those attributes that should not be searched.
            array('type, host, prio, name, dnsZone, position', 'safe'),
            array('host', 'ext.PhonalisaValidators.domainName'),
            array('type', 'required'),
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels()
    {
        return array(
            'type' => __('DNS_RECORD_TYPE'),
            'prio' => __('DNS_RECORD_PRIO'),
            'host' => __('DNS_RECORD_HOST'),
            'name' => __('DNS_RECORD_HOST_NAME')
        );
    }
}
