<?php
namespace app\api\validate;

use app\common\enum\PayEnum;
use app\common\service\ConfigService;
use app\common\validate\BaseValidate;

/**
 * 服务订单验证器
 * Class ServiceOrderValidate
 * @package app\api\validate
 */
class ServiceOrderValidate extends BaseValidate
{

    protected $rule = [
        'order_id'=>'require',
        'sn'=>'require',
        'address' => 'require',
        'appointment_time' => 'require|dateFormat:Y/m/d H:i:s',
        'pay_way' => 'require',
        'goods_id' => 'require',
        'contact_number' => 'require',
        'contact_people' => 'require',
        'lon' => 'require',
        'lat' => 'require',
        'worker_id'=>'require'
    ];


    protected $message = [
        'order_id.require' => '订单ID错误',
        'sn.require' => '订单编号错误',
        'address.require' => '请填写地址',
        'appointment_time.require' => '请填写预约上门时间',
        'appointment_time.dateFormat' => '预约上门时间格式错误',
        'pay_way.require' => '请选择支付方式',
        'goods_id.require' => '订单商品不存在',
        'contact_number.require' => '联系电话不存在',
        'contact_people.require' => '联系人不存在',
        'lon.require' => '经度不存在',
        'lat.require' => '纬度不存在',
        'worker_id.require' => '工程师不存在',
    ];


    public function sceneAdd()
    {
        return $this->only(['address','appointment_time','pay_way','goods_id','contact_number','contact_people']);
    }

    public function sceneFinal()
    {
        return $this->only(['sn']);
    }


    public function sceneDetail()
    {
        return $this->only(['sn']);
    }

    public function sceneWorker()
    {
        return $this->only(['sn']);
    }

    public function sceneCancel()
    {
        return $this->only(['sn']);
    }

    public function scenePrice()
    {
        return $this->only(['sn']);
    }

    public function sceneFinished()
    {
        return $this->only(['sn']);
    }


    public function sceneQueryEffective()
    {
        return $this->only(['sn']);
    }

    public function sceneReceiveEffective()
    {
        return $this->only(['sn','goods_id']);
    }

    public function sceneFirmOrderSave()
    {
        return $this->only(['address','appointment_time','pay_way','contact_number','contact_people']);
    }

    public function sceneCancelOrderCoupon()
    {
        return $this->only(['sn']);
    }
    public function sceneLonLat()
    {
        return $this->only(['lon','lat']);
    }

    public function sceneChangePrice()
    {
        return $this->only(['sn']);
    }

    public function sceneChangeAppointment()
    {
        return $this->only(['sn','appointment_time']);
    }

    public function sceneBindWorkerAndWork()
    {
        return $this->only(['sn','worker_id']);
    }

}