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

// Order(订单)微服务-订单模块
// 订单管理类模块
service Mgt {

    // 创建订单
    rpc OrderCreate(CreateOrderRequest) returns (blocks.OrderStatusReply) {};

    // 修改订单
    rpc OrderModify(blocks.OrderSummaryItem) returns (blocks.OrderStatusReply) {};

    // 获取一个订单的详情数据
    rpc OrderGet(blocks.OrderIdentRequest) returns (OrderGetReply) {};

    // 根据不同的类型获取店铺的订单列表
    rpc OrderListByStore(OrderListByStoreRequest) returns (OrderListByStoreReply) {};

    // 取消订单
    rpc OrderCancel(blocks.OrderIdentRequest) returns (blocks.OrderStatusReply) {};

    // 退货
    rpc OrderReturnable(blocks.OrderIdentRequest) returns (blocks.OrderStatusReply) {};

    // 订单审批
    rpc OrderApprove(blocks.OrderIdentRequest) returns (blocks.OrderStatusReply) {};

}


message CreateOrderRequest{
    int32 partner_id =1 [json_name="partner_id"]; // 合伙人ID
    string args = 2;  // 相关参数
    string address_identity = 3 [json_name="address_identity"];  // 地址库唯一标识
    string delivery_time=4 [json_name="delivery_time"]; // 预约配送时间
    repeated SpecList spec = 5;
}

message SpecList {
    int32 number = 1; // 数量
    string product_identity = 2 [json_name="product_identity"];  // 商品唯一标识
}


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


message OrderListByStoreRequest {
    int32 pay_type = 1 [json_name="pay_type"]; // 支付类型：0:待支付，1:线下支付，2:微信 3:支付宝,4:余额
    repeated 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"];  // 每页记录数
    int64 partner_id = 5 [json_name="partner_id"];// 分销商ID
    string agency = 6 ;// 代理
    string store_identity = 7;// 店铺标识
    int32 status = 8;//  订单状态
    string keyword = 9;// 关键字
}

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