package com.yonge.cooleshow.teacher.vo;

import com.alibaba.fastjson.JSON;
import com.yonge.cooleshow.biz.dal.enums.OrderTypeEnum;
import com.yonge.cooleshow.biz.dal.wrapper.UserPaymentOrderWrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 平台订单表
 * 2022-12-20 19:09:34
 */
@ApiModel(value = "UserPaymentOrderVo对象", description = "平台订单表查询视图对象")
public class UserPaymentOrderVo {

    @Data
    @ApiModel(" UserPaymentOrder-平台订单表")
    public static class UserPaymentOrder {


		@ApiModelProperty("主键")
        private Long id;

		@ApiModelProperty("支付厂商")
        private String paymentVender;

		@ApiModelProperty("支付渠道")
        private String paymentChannel;

		@ApiModelProperty("用户身份")
        private String paymentClient;

		@ApiModelProperty("用户编号")
        private Long userId;

		@ApiModelProperty("商户订单号")
        private String orderNo;

		@ApiModelProperty("交易流水号")
        private String transNo;

		@ApiModelProperty("业务类型Id")
        private String bizId;

		@ApiModelProperty("订单支付类型")
        private String orderType;

		@ApiModelProperty("订单状态")
        private String status;

		@ApiModelProperty("原价")
        private BigDecimal originalPrice;

		@ApiModelProperty("现价")
        private BigDecimal currentPrice;

		@ApiModelProperty("支付现金金额")
        private BigDecimal paymentCashAmount;

		@ApiModelProperty("支付优惠金额")
        private BigDecimal paymentCouponAmount;

		@ApiModelProperty("支付通道费用")
        private BigDecimal paymentChannelFee;

		@ApiModelProperty("订单名称")
        private String orderName;

		@ApiModelProperty("订单描述信息")
        private String orderDesc;

		@ApiModelProperty("用户备注")
        private String userNote;

		@ApiModelProperty("支付时间")
        private Date payTime;

		@ApiModelProperty("原因")
        private String errorMsg;

		@ApiModelProperty("收货地址")
        private Long receiveAddress;

		@ApiModelProperty("更新时间")
        private Date updateTime;

		@ApiModelProperty("下单时间")
        private Date createTime;

        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static UserPaymentOrder from(String json) {
            return JSON.parseObject(json, UserPaymentOrder.class);
        }


        public UserPaymentOrder userId(String userId) {
            this.userId = Long.parseLong(userId);
            return this;
        }

        public UserPaymentOrder paymentClient(String paymentClient) {
            this.paymentClient = String.valueOf(paymentClient);
            return this;
        }
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel("下单请求对象")
    public static class OrderReq implements Serializable {

        @ApiModelProperty("支付类型: adapay")
        private String paymentType;

        @ApiModelProperty("业务类型Id")
        private String bizId;

        @NotNull(message = "订单类型不能为空")
        @ApiModelProperty(value = "订单类型: 学生端（ VIP、开通会员  PRACTICE、趣纠课购买  LIVE、直播课购买 VIDEO、视频课购买 MUSIC、单曲点播 ACTI_REGIST、活动报名 ） 老师端（VIP、开通会员 PIANO_ROOM、琴房时长 ACTI_REGIST 活动报名）", required = true)
        private OrderTypeEnum orderType;

        @ApiModelProperty("现价")
        private BigDecimal currentPrice;

        @ApiModelProperty("支付现金金额")
        private BigDecimal paymentCashAmount;

        @ApiModelProperty("支付优惠金额")
        private BigDecimal paymentCouponAmount;

        @ApiModelProperty("订单名称")
        private String orderName;

        @ApiModelProperty("订单描述信息")
        private String orderDesc;

        @ApiModelProperty("用户备注")
        private String userNote;

        @ApiModelProperty("优惠券Id；多个使用，隔开")
        private String couponIds;

        @ApiModelProperty("订单商品信息")
        private List<UserPaymentOrderWrapper.OrderGoodsInfo> goodsInfos;

        @ApiModelProperty(value = "用户身份", hidden = true)
        private String paymentClient;

        @ApiModelProperty(value = "用户编号", hidden = true)
        private Long userId;

        @ApiModelProperty(value = "推荐用户id(有推荐人的情况)")
        private Long recomUserId;

        @ApiModelProperty(value = "活动id")
        private Long activityId;

        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public OrderReq paymentClient(String paymentClient) {
            this.paymentClient = String.valueOf(paymentClient);
            return this;
        }

        public OrderReq userId(String userId) {
            this.userId = Long.parseLong(userId);
            return this;
        }
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel("订单支付参数配置")
    public static class PaymentReqConfig implements Serializable {

        @ApiModelProperty("支付厂商")
        private String paymentVendor;

        @ApiModelProperty("支付渠道")
        private String paymentChannel;

        @ApiModelProperty("商户订单号")
        private String merOrderNo;

        @ApiModelProperty("商品名称")
        private String subject;

        @ApiModelProperty("商品描述")
        private String body;

        @ApiModelProperty("附加信息")
        private String addition;

        @ApiModelProperty("价格")
        private BigDecimal price;

        @ApiModelProperty("银行卡类型")
        private String bankType;

        @ApiModelProperty("微信授权code")
        private String code;

        @ApiModelProperty("订单过期时间")
        private Date expirationTime;

        @ApiModelProperty("微信支付公众号")
        private String wxAppId;

        @ApiModelProperty(value = "支付用户Id", hidden = true)
        private String userId;

        public String jsonString() {
            return JSON.toJSONString(this);
        }
    }
}
