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 = "sailor")
@IdClass(Sailor.SailorId.class)
public class Sailor extends BaseModel {

    @Id
    @Column(name = "sailor_key")
    private Integer sailorKey;

    @Id
    @Column(name = "fb_key")
    private Integer fbKey;

    @Column(name = "sailor_name_kr")
    private String sailorNameKr;

    @Column(name = "sailor_name_cn")
    private String sailorNameCn;

    @Column(name = "sailor_name_pinyin")
    private String sailorNamePinyin;

    @Column(name = "sailor_contact")
    private String sailorContact;

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

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

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

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

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

    @Column(name = "similar_criminal_history")
    private Integer similarCriminalHistory;

    @Column(name = "heterogeneous_criminal_history")
    private Integer heterogeneousCriminalHistory;

    @Column(name = "arrest_history")
    private Integer arrestHistory;

    @Column(name = "criminal_history_detail")
    private String criminalHistoryDetail;

    @Column(name = "monthly_wages")
    private String monthlyWages;

    @Column(name = "is_restriction")
    private String isRestriction;

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

    @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;

    @Embeddable
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class SailorId implements Serializable {
        private Integer sailorKey;
        private Integer fbKey;
    }
}
