package com.izouma.wenlvju.domain.performance;

import com.alibaba.excel.annotation.ExcelProperty;
import com.izouma.wenlvju.domain.BaseEntity;
import com.izouma.wenlvju.dto.ProgrammeDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Where;

import javax.persistence.Entity;
import java.time.LocalDate;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@ApiModel(value = "参演人员")
@Where(clause = "del = 0")
public class Participant extends BaseEntity {
    private Long programmeId;

    @ApiModelProperty(value = "姓名")
    private String name;

    @ApiModelProperty(value = "性别")
    private String sex;

    @ApiModelProperty(value = "出生年月")
    private LocalDate birthday;

    @ApiModelProperty(value = "照片")
    private String img;

    @ExcelProperty(value = "证件号码")
    @ApiModelProperty(value = "证件号码")
    private String idNo;

    @ApiModelProperty(value = "证书")
    private String certificate;

    private String phone;

    public Participant(ProgrammeDTO dto) {
        this.name = dto.getParticipantName();
        this.sex = dto.getParticipantSex();
        this.birthday = dto.getParticipantBirthday();
        this.img = dto.getImg();
        this.idNo = dto.getIdNo();
        this.certificate = dto.getCertificate();
        this.phone = dto.getParticipantPhone();
    }
}
