package com.gxwebsoft.common.system.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gxwebsoft.common.system.param.MenuParam;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 订单
 *
 * @author 科技小王子
 * @since 2024-10-16 12:32:52
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "Order对象", description = "订单")
@TableName("sys_order")
public class Order implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "订单号")
    @TableId(value = "order_id", type = IdType.AUTO)
    private Integer orderId;

    @Schema(description = "订单编号")
    private String orderNo;

    @Schema(description = "订单类型，0产品 1插件")
    private Integer type;

    @Schema(description = "下单渠道，0网站 1小程序 2其他")
    private Integer channel;

    @Schema(description = "微信支付订单号")
    private String transactionId;

    @Schema(description = "微信退款订单号")
    private String refundOrder;

    @Schema(description = "使用的优惠券id")
    private Integer couponId;

    @Schema(description = "真实姓名")
    private String realName;

    @Schema(description = "手机号码")
    private String phone;

    @Schema(description = "订单总额")
    private BigDecimal totalPrice;

    @Schema(description = "减少的金额，使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格")
    private BigDecimal reducePrice;

    @Schema(description = "实际付款")
    private BigDecimal payPrice;

    @Schema(description = "用于统计")
    private BigDecimal price;

    @Schema(description = "价钱，用于积分赠送")
    private BigDecimal money;

    @Schema(description = "退款金额")
    private BigDecimal refundMoney;

    @Schema(description = "购买数量")
    private Integer totalNum;

    @Schema(description = "0余额支付, 1微信支付，102微信Native，2会员卡支付，3支付宝，4现金，5POS机")
    private Integer payType;

    @Schema(description = "0未付款，1已付款")
    private Boolean payStatus;

    @Schema(description = "0未完成，1已完成，2已取消，3取消中，4退款申请中，5退款被拒绝，6退款成功，7客户端申请退款")
    private Integer orderStatus;

    @Schema(description = "优惠类型：0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡，5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡")
    private Integer couponType;

    @Schema(description = "优惠说明")
    private String couponDesc;

    @Schema(description = "二维码地址，保存订单号，支付成功后才生成")
    private String qrcode;

    @Schema(description = "预约详情开始时间数组")
    private Long startTime;

    @Schema(description = "是否已开具发票：0未开发票，1已开发票，2不能开具发票")
    private Boolean isInvoice;

    @Schema(description = "发票流水号")
    private String invoiceNo;

    @Schema(description = "支付时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date payTime;

    @Schema(description = "退款时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date refundTime;

    @Schema(description = "申请退款时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date refundApplyTime;

    @Schema(description = "过期时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date expirationTime;

    @Schema(description = "对账情况：0=未对账；1=已对账；3=已对账，金额对不上；4=未查询到该订单")
    private Integer checkBill;

    @Schema(description = "订单是否已结算(0未结算 1已结算)")
    private Integer isSettled;

    @Schema(description = "系统版本号 0当前版本 value=其他版本")
    private Integer version;

    @Schema(description = "用户id")
    private Integer userId;

    @Schema(description = "产品控制台")
    private String adminUrl;

    @Schema(description = "备注")
    private String comments;

    @Schema(description = "排序号")
    private Integer sortNumber;

    @Schema(description = "是否删除, 0否, 1是")
    @TableLogic
    private Integer deleted;

    @Schema(description = "租户id")
    private Integer tenantId;

    @Schema(description = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Schema(description = "购买时长")
    @TableField(exist = false)
    private Integer month;

    @Schema(description = "购买数量")
    @TableField(exist = false)
    private Integer cartNum;

    @Schema(description = "应用列表")
    private List<Company> list;

    @Schema(description = "插件安装参数")
    @TableField(exist = false)
    private MenuParam menuParam;

    @Schema(description = "应用名称")
    @TableField(exist = false)
    private String tenantName;

    @Schema(description = "应用图标")
    @TableField(exist = false)
    private String logo;

    @Schema(description = "订单商品")
    @TableField(exist = false)
    private List<OrderGoods> orderGoods;


}
