<?php

namespace app\admin\validate\life;

use support\Validate;

class FarmGoodsValidate extends Validate
{
    protected $rule = [
        'goods_id' => 'require|integer',
        'join_goods_category_id' => 'require|integer',
        'goods_classify' => '',
        'goods_status' => 'integer',    // 产品状态 PENDING=待处理|ON=上架(已激活)|OFF=下架|DISABLED=已禁用
        'goods_category' => '',
        'goods_prefix' => '',
        'goods_name' => 'require',
        'goods_market_price' => '',
        'goods_sales_price' => '',
        'goods_sku_json' => '',
        'goods_attribute_json' => '',
        'goods_service_json' => '',
        'goods_title' => '',
        'goods_cover' => '',
        'goods_on_addtimes' => '',
        'goods_img' => 'require|regex:/^[0-9a-zA-Z\.\/]+$/',
        'food_slide' => 'regex:/^[0-9a-zA-Z\.\/\,]+$/',
        'goods_shop_id' => 'require|integer',
        'goods_is_new' => 'integer',
        'goods_price' => 'require|float',
        'goods_sell_num' => 'require|integer',
        'goods_postage_id' => 'require|integer',
        'goods_weight' => 'float',
        'goods_storage' => 'max:255',
        'goods_packaging' => 'max:255',
        'goods_varieties' => 'max:255',
        'goods_attr' => 'max:255',
        'goods_sort' => 'require|integer'
    ];

    protected $message = [];

    protected $scene = [
        'add' => ['goods_name', 'goods_img', 'food_slide', 'goods_category_id', 'goods_shop_id', 'goods_is_new', 'goods_price', 'goods_sell_num', 'goods_postage_id', 'goods_status', 'goods_weight', 'goods_storage', 'goods_packaging', 'goods_varieties', 'goods_attr', 'goods_sort'],
        'update' => ['goods_id', 'goods_name', 'goods_img', 'food_slide', 'goods_category_id', 'goods_shop_id', 'goods_is_new', 'goods_price', 'goods_sell_num', 'goods_postage_id', 'goods_status', 'goods_weight', 'goods_storage', 'goods_packaging', 'goods_varieties', 'goods_attr', 'goods_sort'],
    ];
}