package com.izouma.nineth.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
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 org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;

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;

    @Column(columnDefinition = "TEXT")
    @Convert(converter = MintMaterialListConverter.class)
    @ApiModelProperty("铸造材料")
    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;

    private LocalDateTime payAt;

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

}
