<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "city".
 *
 * @property integer $id_city
 * @property string $zip
 * @property string $name
 * @property string $city_code
 * @property double $latitude
 * @property double $longitude
 * @property integer $cso_code
 * @property integer $rig_id
 * @property double $range
 * @property integer $population
 * @property integer $homes
 */
class City extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'city';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['zip', 'name', 'city_code'], 'required'],
            [['latitude', 'longitude', 'range'], 'number'],
            [['cso_code', 'rig_id', 'population', 'homes'], 'integer'],
            [['zip'], 'string', 'max' => 8],
            [['name'], 'string', 'max' => 64],
            [['city_code'], 'string', 'max' => 2]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id_city' => Yii::t('common/city', 'Id City'),
            'zip' => Yii::t('common/city', 'Zip'),
            'name' => Yii::t('common/city', 'Name'),
            'city_code' => Yii::t('common/city', 'City Code'),
            'latitude' => Yii::t('common/city', 'Latitude'),
            'longitude' => Yii::t('common/city', 'Longitude'),
            'cso_code' => Yii::t('common/city', 'Cso Code'),
            'rig_id' => Yii::t('common/city', 'Rig ID'),
            'range' => Yii::t('common/city', 'Range'),
            'population' => Yii::t('common/city', 'Population'),
            'homes' => Yii::t('common/city', 'Homes'),
        ];
    }
}
