<?php


namespace Validate;


/**
 * Class addValidate
 *
 * @package Validate
 */
class OtaValidate extends \Validate\BaseValidate
{
    protected $rule = [
        'ota_name' => 'require',
        'ota_id' => 'require',
//        'address' => 'require',
//        'location' => 'require',
//        'longitude' => 'require',
//        'latitude' => 'require',
        'offset' => 'egt:0',
        'limit' => 'elt:100',
    ];


    protected $message = [
        "ota_name" => "供应商名称不能为空",
        "ota_id" => "ota_id不能为空",
        "address" => "详细地址不能为空",
        "location" => "高德地图详细地址不能为空",
        "longitude" => "经度不能为空",
        "latitude" => "纬度不能为空",
        "offset" => "偏移量不能小于0",
        "limit" => "单次不能大于100条",
    ];


    public function sceneList()
    {
        return $this->only(['offset','limit']);
    }

    public function sceneAdd()
    {
        return $this->only(['ota_name']);
    }
    public function sceneDelete()
    {
        return $this->only(['ota_id']);
    }

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

    public function sceneUpdate()
    {
        return $this->only(['ota_id', 'ota_name']);
    }
    public function sceneListByIds()
    {
        return $this->only(['ota_id']);
    }


    public function is_label_printer_sn($value){
        if( substr($value, 3, 1) != '2' ){
            return false;
        }
        return true;
    }
}