package com.dbnt.faisp.faStatistics.crackdownStatus.model;

import com.dbnt.faisp.config.BaseModel;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "process_result")
@IdClass(ProcessResult.ProcessResultId.class)
public class ProcessResult extends BaseModel {

    @Id
    @Column(name = "pr_key")
    private Integer prKey;

    @Id
    @Column(name = "cds_key")
    private Integer cdsKey;

    @Column(name = "process_status")
    private String processStatus;

    @Column(name = "pressurized_time_taken")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime pressurizedTimeTaken;

    @Column(name = "warrant_req_take_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime warrantReqTakeTime;

    @Column(name = "is_ivsgt_stop")
    private String isIvsgtStop;

    @Column(name = "eviction_dt")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private String evictionDt;

    @Column(name = "direct_handover_dt")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime directHandoverDt;

    @Column(name = "handover_sea_point_lon")
    private String handoverSeaPointLon;

    @Column(name = "handover_sea_point_lat")
    private String handoverSeaPointLat;

    @Column(name = "handover_sea_point_detail")
    private String handoverSeaPointDetail;

    @Column(name = "handover_boat")
    private String handoverBoat;

    @Column(name = "middle_takeover_boat")
    private String middleTakeoverBoat;

    @Column(name = "consignment_start_dt")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime consignmentStartDt;

    @Column(name = "consignment_end_dt")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime consignmentEndDt;

    @Column(name = "confiscation_dt")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime confiscationDt;

    @Column(name = "boat_disposal_dt")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime boatDisposalDt;

    @Column(name = "boat_disposal_type")
    private String boatDisposalType;

    @Column(name = "return_dt")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime returnDt;

    @Column(name = "exile_cnt")
    private Integer exileCnt;

    @Column(name = "exile_dt")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime exileDt;

    @Column(name = "flight")
    private String flight;

    @Column(name = "immigration_office_name")
    private String immigrationOfficeName;

    @Column(name = "immigration_office_officer_name")
    private String immigrationOfficeOfficerName;

    @Column(name = "immigration_office_officer_contact")
    private String immigrationOfficeOfficerContact;

    @Column(name = "sentencing_court")
    private String sentencingCourt;

    @Column(name = "sentencing_detail")
    private String sentencingDetail;

    @Column(name = "execution_detail")
    private String executionDetail;

    @Column(name = "wrt_organ")
    private String wrtOrgan;

    @Column(name = "wrt_user_seq")
    private Integer wrtUserSeq;

    @Column(name = "wrt_nm")
    private String wrtNm;

    @Column(name = "wrt_dt")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime wrtDt;

    @Transient
    private String processStatusEtc;

    @Embeddable
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class ProcessResultId implements Serializable {
        private Integer prKey;
        private Integer cdsKey;
    }
}
