<?php

/**
 * This is the model class for table "emails".
 *
 * The followings are the available columns in table 'emails':
 * @property integer $id
 * @property integer $userId
 * @property integer $timestamp
public  $subject
public  $folder
public  $message_id
public  $to_personal
public  $to_mailbox
public  $to_host
public  $from_personal
public  $from_mailbox
public  $from_host
public  $reply_to_personal
public  $reply_to_mailbox
public  $reply_to_host
public  $recent
public  $unseen
public  $flagged
public  $answered
public  $deleted
public  $draft
public  $msgno
public  $maildate
public  $size
public  $body_raw
 */
 
class EmailState{
    const EmailStatePending = 0;
    const EmailStateQueued = 1;
    const EmailStateSending = 2;
    const EmailStateSent = 3;
    const EmailStateFailed = 4;
}

class EmailType{
    const EmailTypeUndefined = 0;
    const EmailTypeTest = 1;
    const EmailTypePasswordRecovery = 2;
} 
 
 
class EMail extends PhonalisaRecord
{
    public $subject;
    public $text;
    public $recipient;
    public $type;
    public $state;
    public $errortext;
    
    
    public static function myAttributes() {
        return array(
            'subject'=>'subject',
            'text'=>'text',
            'recipient'=>'recipient',
            'type'=>'type',
            'state'=>'state',
            'errortext'=>'errortext',
        );
    }
	
	
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return EMails the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'emails';
	}

	/**
	 * @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(
			array('recipient, type', 'required'),
			array('recipient','email'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'sent' => __('EMAIL_MODEL_SENT'), //__('Sent'),
			'state' => __('EMAIL_MODEL_STATE'), //__('Sent'),
			'type' => __('EMAIL_MODEL_TYPE'), //__('Sent'),
			'errortext' => __('EMAIL_MODEL_ERRORTEXT'), //__('Sent'),
		);
	}	
	
}