syntax = "proto3";
package mall;
option go_package = "bsm/full/module/ec/mall/pb;mall";
import "module/ec/mall/proto/const.proto";

// 运费设置相关
service Freight{
  // 运费模板列表
  rpc Fetch(ec_mall_blocks.MallFetchRequest) returns(FreightReply) {};

  // 运费模板修改
  rpc Modify(FreightItem) returns(ec_mall_blocks.IdentityStatusReply) {};

  // 运费模板删除
  rpc Delete(ec_mall_blocks.IdentRequest) returns(ec_mall_blocks.IdentityStatusReply) {};

  // 运费模板创建
  rpc Create(FreightItem) returns(ec_mall_blocks.IdentityStatusReply) {};

  // 运费模板详情
  rpc Detail(ec_mall_blocks.IdentRequest) returns(FreightItem) {};

  // 限制区域列表
  rpc DenyRegionFetch (ec_mall_blocks.MallFetchRequest) returns(DenyRegionReply) {};

  // 新建限制区域
  rpc DenyRegionCreate (DenyRegionItem) returns(ec_mall_blocks.IdentityStatusReply) {};

  // 移除限制区域
  rpc DenyRegionDelete (ec_mall_blocks.IdentRequest) returns(ec_mall_blocks.IdentityStatusReply) {};

  // 编辑限制区域
  rpc DenyRegionModify (DenyRegionItem) returns(ec_mall_blocks.IdentityStatusReply) {};

}

message DenyRegionItem{
  int64 id = 1;
  string identity = 2;
  string mall_identity = 3 [json_name="mall_identity"];
  string title = 4; // 名称
  repeated RegionItem region = 5; // 限售区域
}

message FreightItem{
  int64 id = 1; //属性ID
  string identity = 2; //唯一标识
  int32 status = 3; // 状态：1正常，-1禁用
  string title = 4; // 名称
  int32 post_type = 5 [json_name="post_type"]; // 是否包邮：1包邮，2不包邮
  int64 quota = 6; // 当types=1时，满额包邮
  int32 cost_type = 7 [json_name="cost_type"]; // 计费类型：1计件收费，2按重收费,3按体积收费
  int32 region_type = 8 [json_name="region_type"]; // 区域限售:1限制，2不限制
  repeated FreightAttrItem rules = 9; // 计费规则
 }

 message RegionItem{
  int32 id =1;
  string name = 2;
  repeated RegionItem second = 3;
 }

message FreightAttrItem{
  int64 id = 1;
  string identity = 2; //
  string freight_identity = 3 [json_name="freight_identity"]; // 模板唯一标识
  string region_str = 4 [json_name="region_str"]; // 地区名称
  repeated RegionItem region = 5; // 地区
  int64 price_basic = 6 [json_name="price_basic"]; // 起步运费
  int64 count_basic = 7 [json_name="count_basic"]; // 起步数量
  int64 count_extra = 8 [json_name="count_extra"]; // 加价数量
  int64 price_extra = 9 [json_name="price_extra"]; // 加价单价
  int32 status = 10; // 状态：1正常，-1禁用
  int32 is_default = 11 [json_name="is_default"]; // 是否是默认：1-不是；2是
}

message FreightReply{
  int64 count = 1;
  repeated FreightItem data = 2;
}

message DenyRegionReply{
  int64 count = 1;
  repeated DenyRegionItem data = 2;
}
