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 = "fishing_boat")
@IdClass(FishingBoat.FishingBoatId.class)
public class FishingBoat extends BaseModel {

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

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

    @Column(name = "boat_name_kr")
    private String boatNameKr;

    @Column(name = "boat_name_cn")
    private String boatNameCn;

    @Column(name = "permit_num")
    private String permitNum;

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

    @Column(name = "ton_cnt")
    private Integer tonCnt;

    @Column(name = "fishery_type")
    private String fisheryType;

    @Column(name = "boat_material")
    private String boatMaterial;

    @Column(name = "boat_nny_sung")
    private String boatNnySung;

    @Column(name = "boat_nny_si")
    private String boatNnySi;

    @Column(name = "offense_type")
    private String offenseType;

    @Column(name = "offense_quantity")
    private Integer offenseQuantity;

    @Column(name = "offense_amount")
    private Integer offenseAmount;

    @Column(name = "offense_illegal_waste_quantity")
    private Integer offenseIllegalWasteQuantity;

    @Column(name = "dambo_unpaid_amount")
    private Integer damboUnpaidAmount;

    @Column(name = "dambo_payment")
    private Integer damboPayment;

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

    @Column(name = "confiscation_frame")
    private String confiscationFrame;

    @Column(name = "confiscation_width")
    private String confiscationWidth;

    @Column(name = "confiscation_jo")
    private String confiscationJo;

    @Column(name = "confiscation_gae")
    private String confiscationGae;

    @Column(name = "confiscation_etc")
    private String confiscationEtc;

    @Column(name = "catch_fish_species")
    private String catchFishSpecies;

    @Column(name = "catch_cnt")
    private Integer catchCnt;

    @Column(name = "offense_fish_species")
    private String offenseFishSpecies;

    @Column(name = "offense_catch_cnt")
    private Integer offenseCatchCnt;

    @Column(name = "save_yn")
    private String saveYn;

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

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