package com.izouma.nineth.domain;

import com.izouma.nineth.annotations.Searchable;
import com.izouma.nineth.converter.FileObjectConverter;
import com.izouma.nineth.converter.FileObjectListConverter;
import com.izouma.nineth.converter.PrivilegeListConverter;
import com.izouma.nineth.converter.PropertyListConverter;
import com.izouma.nineth.enums.CollectionStatus;
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.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
@ApiModel("企业申请的藏品")
public class CompanyCollection extends BaseEntity {
    private Long userId;

    @ApiModelProperty("铸造者")
    private String minter;

    @ApiModelProperty("名称")
    @Searchable
    private String name;

    @ApiModelProperty("图片")
    @Column(columnDefinition = "TEXT")
    @Convert(converter = FileObjectListConverter.class)
    private List<FileObject> pic;

    @Column(columnDefinition = "TEXT")
    @Convert(converter = FileObjectConverter.class)
    private FileObject model3d;

    @ApiModelProperty("详情")
    @Column(columnDefinition = "TEXT")
    private String detail;

    @ApiModelProperty("分类")
    private String category;

    @ApiModelProperty("发行数量")
    private int total;

    @ApiModelProperty("价格")
    @Column(precision = 10, scale = 2)
    private BigDecimal price;

    @ApiModelProperty("原价")
    @Column(precision = 10, scale = 2)
    private BigDecimal originalPrice;

    @ApiModelProperty("限购数量")
    private int maxCount;

    @ApiModelProperty("限购识别码")
    private String countId;

    private Long oasisId;

    private Long raceId;

    private Long groupId;

    private Long itemId;

    @Column(columnDefinition = "TEXT")
    @Convert(converter = PropertyListConverter.class)
    @ApiModelProperty("特性")
    private List<CollectionProperty> properties;

    @Column(columnDefinition = "TEXT")
    @Convert(converter = PrivilegeListConverter.class)
    @ApiModelProperty("特权")
    private List<Privilege> privileges;

    @ApiModelProperty("是否可转售")
    private boolean canResale;

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

    @ApiModelProperty("拒绝理由")
    private String reason;
}
