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

// Order(订单)微服务-订单模块
// C端模块
service Summary {

    // 快速创建一个店铺订单
    rpc QuickCreateByProduct(QuickCreateByProductRequest) returns (ec_order_blocks.OrderStatusReply) {};

    // 将购物车的数据提交生成订单
    rpc Submit(SubmitRequest) returns (ec_order_blocks.OrderStatusReply) {};

    // 检测是否有未确认及付款的订单
    rpc Check(ec_order_blocks.Empty) returns (ec_order_blocks.OrderStatusReply) {};

    // 获取一个订单的详情数据
    rpc Get(ec_order_blocks.OrderIdentRequest) returns (SummaryGetReply) {};

    // 根据不同的类型获取我的订单列表
    rpc List(SummaryListRequest) returns (SummaryListReply) {};

    // 确认订单，物流，优惠卷等其它信息
    rpc Confirm(ConfirmRequest) returns (ConfirmReply) {};


    // 取消订单
    rpc Cancel(CancelRequest) returns (ec_order_blocks.OrderStatusReply) {};

    // 模拟支付
    rpc SimulatePay(SimulatePayRequest) returns (ec_order_blocks.OrderStatusReply) {};

    // 模拟发货
    rpc SimulateShipments(SimulateShipmentsRequest) returns (ec_order_blocks.OrderStatusReply) {};

    // 模拟收货
    rpc SimulateReceiving(ec_order_blocks.OrderIdentRequest) returns (ec_order_blocks.OrderStatusReply) {};
}
message SimulateShipmentsRequest{
    string identity = 1; // 订单唯一标识
    string item_idetity = 2 [json_name="item_idetity"]; // 配送团队唯一标识
    string member_identity = 3 [json_name="member_identity"]; // 配送人员唯一标识
    string car_identity =4 [json_name="car_identity"]; // 配送车辆唯一标识
}
message SubmitReply{
    int64 status = 1; // 状态码
    repeated string identity=2; // 标识码
    string message=3; //状态说明
	int64 timeseq=4; // 响应时间序列
}
message SimulatePayRequest{
    repeated string identity = 1;
}
message QuickCreateByProductRequest{
    int32 partner_id =1 [json_name="partner_id"]; // 合伙人ID
    string store_identity =2 [json_name="store_identity"];  // 店铺唯一标识
    string product_identity = 3 [json_name="product_identity"];  // 商品唯一标识
    int32 number = 4; // 数量
    string args = 5;  // 相关参数
    string address_identity = 6 [json_name="address_identity"];  // 地址库唯一标识
    string delivery_time=7 [json_name="delivery_time"]; // 预约配送时间
    string spec_identity = 8 [json_name="spec_identity"]; // 规格identity
    string member_identity = 9 [json_name="member_identity"]; // 配送员唯一标识
    string delivery_address = 10 [json_name="delivery_address"]; // 配送地址
}

message SubmitRequest {
    repeated string id = 1;  // 购物车的ID数据，以逗号分开
    int32 partner_id =2 [json_name="partner_id"]; // 合伙人ID
    string store_identity =3 [json_name="store_identity"];  // 店铺唯一标识
    string address_identity = 4 [json_name="address_identity"];  // 地址库唯一标识
    string delivery_time=5 [json_name="delivery_time"]; // 预约配送时间
    OrderAddress address = 6;// 地址详情
}

message OrderAddress {
    string country = 1;     // 国家
    string province = 2;    // 省/州
    string city = 3;        // 市
    string area = 4;        // 区
    string detail = 5;      // 详细地址
    string contact = 6;     // 联系人
    string phone = 7;       // 手机号码
    string email = 8;       // 邮箱
    string zip_code = 9;    // 邮编
}

message SummaryGetReply {
    ec_order_blocks.OrderSummaryItem summary = 1; // 订单概要详情
}


message SummaryListRequest {
    int32 pay_type = 1 [json_name="pay_type"]; // 支付类型：0:待支付，1:线下支付，2:微信 3:支付宝,4:余额
    int32 order_status= 2 [json_name="order_status"]; // 订单状态 1：未支付 2：已支付 3：已发货 4：已收货 5:已完成  6:已收货退款 7：未发货退款 8:已退货 -1：已取消
    int64 page_no = 3 [json_name="page_no"];
    int64 page_size = 4 [json_name="page_size"];
}

message SummaryListReply {
    int32 count = 1;
    repeated ec_order_blocks.OrderSummaryItem data = 2;  // 订单列表
}

message ConfirmRequest {
    string order_no = 1 [json_name="order_no"];  // 订单唯一码
    string address_identity = 2 [json_name="address_identity"];  // 地址identity
    string coupon_identity = 3 [json_name="coupon_identity"];  // 优惠卷
    string remark = 4; //备注
    double logistics_fee = 5 [json_name="logistics_fee"]; //运费
}

message ConfirmReply {
    int64 total_price = 1 [json_name="total_price"]; // 总价
}


message CancelRequest {
    string order_no = 1 [json_name="order_no"];  // 订单唯一码
    string type = 2; // 订单类型
}

