<?php


namespace Validate;


/**
 * Class addValidate
 *
 * @package Validate
 */
class TakePlaceValidate extends \Validate\BaseValidate
{
    protected $rule = [
        'take_place_id' => 'require',
        'name' => 'require',
        'address' => 'require',
        'location' => 'require',
        'longitude' => 'require',
        'latitude' => 'require',
        'province' => 'require',
        'city' => 'require',
        'area' => 'require',
        'page' => 'egt:1',
        'offset' => 'egt:0',
        'limit' => 'elt:500',
    ];

    protected $message = [
        "take_place_id" => "take_place_id不能为空",
        "marketing_id" => "marketing_id不能为空",
        "name" => "自提点名称不能为空",
        "address" => "详细地址(原商圈)不能为空",
        "location" => "高德地图详细地址不能为空",
        "longitude" => "经度不能为空",
        "latitude" => "纬度不能为空",
        "province" => "省不能为空",
        "city" => "市不能为空",
        "area" => "区不能为空",
        'page' => '偏移量不能小于1',
        "offset" => "偏移量不能小于0",
        "limit" => "单次不能大于500条",
    ];


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

    public function sceneAdd()
    {
        return $this->only(['name','address','longitude','latitude','province','area']);
    }
    public function sceneDelete()
    {
        return $this->only(['take_place_id']);
    }

    public function sceneBindList()
    {
        return $this->append(['marketing_id' => 'require'])->only(['marketing_id','page','limit']);
    }
}