<?php

namespace backend\models\forms;

use Yii;
use yii\base\Model;

/**
 * 返佣规则
 */
class CommissionForm extends Model
{
    public $id;
    public $login;
    public $member_id;
    public $forex;
    public $metal;
    public $cfd;
    public $gold;
    public $silver;
    public $wy;
    public $in_time;

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            // admin_batch_set
            [['forex', 'metal', 'cfd', 'gold', 'silver', 'wy'], 'number', 'on' => 'admin_batch_set'],
        ];
    }

    /**
     * @inheritdoc
     * @return array
     */
    public function scenarios()
    {
        $scenarios = parent::scenarios();
        $scenarios['admin_batch_set'] = ['id', 'login', 'member_id', 'forex', 'metal', 'cfd', 'gold', 'silver', 'wy', 'in_time'];
        return $scenarios;
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        if (in_array($this->getScenario(), ['admin_batch_set'])) {
            return [
                'forex' => 'FOREX',
                'metal' => 'METAL',
                'cfd' => 'CFD',
                'gold' => '黄金',
                'silver' => '白银',
                'wy' => '外佣',
            ];
        }
        
        return [];
    }

}
