package com.izouma.wenlvju.domain.performance;

import com.izouma.wenlvju.converter.PerformanceEnquiryListConverter;
import com.izouma.wenlvju.domain.BaseEntity;
import com.izouma.wenlvju.dto.PerformanceEnquiry;
import com.izouma.wenlvju.enums.PerformanceStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Where;

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

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
@Where(clause = "del = 0")
@ApiModel(value = "展演管理")
public class Performance extends BaseEntity {
    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "年度")
    private String year;

    @ApiModelProperty(value = "报名开始时间")
    private LocalDate startDate;

    @ApiModelProperty(value = "报名截止时间")
    private LocalDate endDate;

    @ApiModelProperty(value = "展演形式")
    private boolean online;

    @Column(columnDefinition = "TEXT")
    @Convert(converter = PerformanceEnquiryListConverter.class)
    @ApiModelProperty(value = "咨询电话")
    private List<PerformanceEnquiry> performanceEnquiries;


    private String email;

    /**
     * 附件
     */
    @ApiModelProperty(value = "活动方案")
    private String annex;

    private String codeImg;

    @ApiModelProperty(value = "是否发布")
    private boolean publish;

    @Enumerated(EnumType.STRING)
    @ApiModelProperty(value = "状态")
    private PerformanceStatus status;

    @ApiModelProperty(value = "审核次数")
    private int auditTimes;

    @ApiModelProperty(value = "复审展演形式")
    private Boolean reviewOnline;

    @ApiModelProperty(value = "复审比例")
    private BigDecimal reviewRatio;

    private boolean close;

    @Transient
    private long programmeNum;
}
