package com.izouma.wenlvju.dto;

import com.alibaba.excel.annotation.ExcelProperty;
import com.izouma.wenlvju.domain.Record;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("Record management")
public class RecordExcelDTO {
    @ExcelProperty(value = "考级活动名称")
    private String examinationName;

    @ExcelProperty(value = "考级活动时间")
    private String examinationTime;

    @ExcelProperty(value = "考级机构名称")
    private String examinationAgency;

    @ExcelProperty(value = "承办单位名称")
    private String organizer;

    @ExcelProperty(value = "考级地点")
    private String district;

    @ExcelProperty(value = "备案时间")
    private LocalDate recordTime;

    @ExcelProperty(value = "状态")
    private String status;

    public RecordExcelDTO(Record record) {
        this.examinationName = record.getExaminationName();
        this.examinationTime = record.getExaminationStartTime() + " 至 " + record.getExaminationEndTime();
        this.examinationAgency = record.getExaminationAgency();
        this.organizer = record.getOrganizer();
        this.district = record.getDistrict();
        this.recordTime = record.getRecordTime();
        this.status = record.getStatus().getSpec();
    }
}
