package com.izouma.nineth.domain;

import com.izouma.nineth.annotations.Searchable;
import com.izouma.nineth.converter.MintMaterialListConverter;
import com.izouma.nineth.enums.MintOrderStatus;
import com.izouma.nineth.enums.PayMethod;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel("铸造订单")
public class MintOrder extends BaseEntity {

    private Long userId;

    @Searchable
    private String phone;

    private Long mintActivityId;

    @Transient
    private String mintActivity;

//    @Column(columnDefinition = "TEXT")
//    @Convert(converter = MintMaterialListConverter.class)
//    @ApiModelProperty("铸造材料")
    @Transient
    private List<MintMaterial> material;

    @ApiModelProperty("收货人")
    private String contactName;

    @ApiModelProperty("收货电话")
    private String contactPhone;

    @ApiModelProperty("收货地址")
    private String address;

    @ApiModelProperty("gas费")
    @Column(precision = 10, scale = 2)
    private BigDecimal gasPrice;

    @ApiModelProperty("状态")
    @Enumerated(EnumType.STRING)
    private MintOrderStatus status;

    @ApiModelProperty("支付方式")
    @Enumerated(EnumType.STRING)
    private PayMethod payMethod;

    @ApiModelProperty("交易ID")
    @Searchable
    private String transactionId;

    @ApiModelProperty("取消时间")
    private LocalDateTime cancelTime;

    @ApiModelProperty("支付时间")
    private LocalDateTime payAt;

    @ApiModelProperty("是否消耗藏品")
    private boolean consume;

    @ApiModelProperty("空投/实物")
    private boolean airDrop;

    @ApiModelProperty("快递单号")
    private String courierId;
}
