<?php
namespace app\workerapi\validate;


use app\common\validate\BaseValidate;


/**
 * ServiceWork验证器
 * Class ServiceWorkValidate
 * @package app\workerapi\validate\works
 */
class ServiceWorkValidate extends BaseValidate
{

     /**
      * 设置校验规则
      * @var string[]
      */
    protected $rule = [
        'id' => 'require',
        'work_sn' => 'require',
        'mobile' => 'require',
        'address' => 'require',
        'title' => 'require',
        'category_type' => 'require',
        'goods_category_ids' => 'require',
        'goods_category_id' => 'require',
        'base_service_fee' => 'require',
        'service_fee' => 'require',
        'work_status' => 'require',
        'service_status' => 'require',
        'dispatch_time' => 'require',
        'receive_time' => 'require',
        'appointment_time' => 'require|dateFormat:Y/m/d H:i:s',
        'finished_time' => 'require',
        'master_worker_id' => 'require',
        'order_sn'=>'require',
        'amount'=>'require',
        'finished_images'=>'require',
        'work_images'=>'require',
    ];


    /**
     * 参数描述
     * @var string[]
     */
    protected $field = [
        'id' => 'id',
        'work_sn' => '工单编号',
        'mobile' => '手机号',
        'address' => '客户地址',
        'title' => '工单名称',
        'category_type' => '服务类别',
        'goods_category_ids' => '服务类目',
        'goods_category_id' => '服务产品',
        'base_service_fee' => '基础服务费',
        'service_fee' => '服务费用',
        'work_status' => '工单状态',
        'service_status' => '订单服务状态',
        'dispatch_time' => '派单时间',
        'receive_time' => '领单时间',
        'appointment_time' => '预约上门时间',
        'finished_time' => '结单时间',
        'master_worker_id' => '工程师',
        'order_sn'=>'未获取到扫码信息',
        'amount'=>'报价',
        'finished_images'=>'完结服务拍照',
        'work_images'=>'工作拍照'
    ];

    /**
     * 领取场景
     * @return ServiceWorkValidate
     */
    public function scenePick()
    {
        return $this->only(['work_sn']);
    }

    /**
     * 领取场景
     * @return ServiceWorkValidate
     */
    public function sceneDetail()
    {
        return $this->only(['*']);
    }

    /**
     * 预约上门场景
     * @return ServiceWorkValidate
     */
    public function sceneAppoint()
    {
        return $this->only(['work_sn','address','appointment_time']);
    }

    /**
     * 确认上门场景
     * @return ServiceWorkValidate
     */
    public function sceneDoor()
    {
        return $this->only(['work_sn']);
    }

    public function scenePrice()
    {
        return $this->only(['work_sn','amount','work_images']);
    }

    public function sceneFinished()
    {
        return $this->only(['work_sn','finished_images']);
    }
    public function sceneSpare()
    {
        return $this->only(['work_sn']);
    }

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

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