<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "network_phone_t".
 *
 * @property int $id
 * @property string $corp_key
 * @property int $ts
 * @property string $sign
 * @property string $recorder_id
 * @property string $caller
 * @property string $called
 * @property string $caller_show
 * @property string $called_show
 * @property string $begin_time
 * @property string $connect_time
 * @property string $alerting_time
 * @property string $release_time
 * @property int $call_duration
 * @property int $bill_duration
 * @property string $call_result
 * @property string $record_file_url
 * @property string $call_cost
 * @property string $caller_area
 * @property string $called_area
 * @property string $extend
 */
class NetworkPhoneT extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'network_phone_t';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['id'], 'required'],
            [['id', 'ts', 'call_duration', 'bill_duration'], 'integer'],
            [['corp_key', 'extend'], 'string', 'max' => 225],
            [['sign', 'begin_time', 'connect_time', 'alerting_time', 'release_time', 'call_result', 'record_file_url'], 'string', 'max' => 255],
            [['recorder_id'], 'string', 'max' => 128],
            [['caller', 'called', 'caller_show', 'called_show', 'caller_area', 'called_area'], 'string', 'max' => 32],
            [['call_cost'], 'string', 'max' => 10],
            [['id'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'corp_key' => 'Corp Key',
            'ts' => 'Ts',
            'sign' => 'Sign',
            'recorder_id' => 'Recorder ID',
            'caller' => 'Caller',
            'called' => 'Called',
            'caller_show' => 'Caller Show',
            'called_show' => 'Called Show',
            'begin_time' => 'Begin Time',
            'connect_time' => 'Connect Time',
            'alerting_time' => 'Alerting Time',
            'release_time' => 'Release Time',
            'call_duration' => 'Call Duration',
            'bill_duration' => 'Bill Duration',
            'call_result' => 'Call Result',
            'record_file_url' => 'Record File Url',
            'call_cost' => 'Call Cost',
            'caller_area' => 'Caller Area',
            'called_area' => 'Called Area',
            'extend' => 'Extend',
        ];
    }

    public function getUser()
    {
        return $this->hasOne(UserT::className(),['id'=>'user_id']);
    }
}
