package com.app.entity.order;

import com.app.constant.OrderConstant;
import com.app.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;

@ApiModel("开课 - 订单")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@TableName("t_open_course_order")
public class OpenCourseOrder extends BaseEntity {

    @ApiModelProperty("机构id")
    @NotEmpty
    @TableField("organ_id")
    private String organId;

    @ApiModelProperty("家长标识")
    @NotBlank
    @TableField(value = "guardian_id")
    private String guardianId;

    @ApiModelProperty("应付价格")
    @NotNull
    @TableField("payable_price")
    private Double payablePrice;

    @ApiModelProperty("退款")
    @NotNull
    @TableField("refund")
    private Double refund;

    @ApiModelProperty("实付价格")
    @NotNull
    @TableField("paid_price")
    private Double paidPrice;

    /**
     * @see OrderConstant.OrderState
     */
    @ApiModelProperty("订单支付状态")
    @NotNull
    @TableField("state")
    private Integer state;

    @ApiModelProperty("订单过期时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("order_expire_time")
    private Date orderExpireTime;

    @ApiModelProperty("支付完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField("pay_end_time")
    private Date payEndTime;

    @ApiModelProperty("微信支付订单号")
    @TableField("transaction_id")
    private String transactionId;

    @ApiModelProperty("微信表单标识")
    @NotEmpty
    @TableField("wxmp_form_id")
    private String wxmpFormId;

}
