package io.gmss.fiscad.entities.rfu.metier;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
import io.gmss.fiscad.entities.BaseEntity;
import io.gmss.fiscad.entities.infocad.metier.Enquete;
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
import io.gmss.fiscad.entities.infocad.metier.Tpe;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.Where;

import java.io.Serializable;
import java.time.LocalDate;

@EqualsAndHashCode(callSuper = true)
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(
        name = "donnees_imposition_tfu",
        uniqueConstraints = {
                @UniqueConstraint(columnNames = {"codeCommune","q","ilot","parcelle","annee","numBatiment","numUniteLogement","impositions_tfu_id"}),
                @UniqueConstraint(columnNames = {"codeCommune","nup", "annee","numBatiment","numUniteLogement","impositions_tfu_id"}),
                @UniqueConstraint(columnNames = {"codeCommune","nupProvisoire", "annee","numBatiment","numUniteLogement","impositions_tfu_id"})
        }
)
public class DonneesImpositionTfu extends BaseEntity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private Long annee;
    private String codeDepartement;
    private String nomDepartement;
    private String codeCommune;
    private String nomCommune;
    private String codeArrondissement;
    private String nomArrondissement;
    private String codeQuartierVillage;
    private String nomQuartierVillage;
    private String q;
    private String ilot;
    private String parcelle;
    private String nup;
    private String nupProvisoire;
    private String titreFoncier;
    private String numBatiment;
    private String numUniteLogement;
    private String ifu;
    private String npi;
    private String telProp;
    private String emailProp;
    private String nomProp;
    private String prenomProp;
    private String raisonSociale;
    private String adresseProp;
    private String telSc;
    private String emailSc;
    private String nomSc;
    private String prenomSc;
    private String adresseSc;
    private String longitude;
    private String latitude;
    private int superficieParc;
    private Long superficieAuSolBat;
    private Long superficieAuSolUlog;
    private String batieOuiNon;
    private String exhonereOuiNon;
    private String batimentExhonereOuiNon;
    private String uniteLogementExhonereOuiNon;
    private Long valeurLocativeAdm;
    private Long montantLoyerAnnuel;
    private Long tfuMetreCarre;
    private Long tfuMinimum;
    private String standingBat;
    private String categorieBat;
    private Long nombrePiscine;
    private Long nombreUlog;
    private Long nombreBat;
    @JsonFormat(pattern = "dd-MM-yyyy")
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate dateEnquete;
    private Long enqueteId;
    private Long structureId;
    private Long secteurId;

    private Long zoneRfuId;
    @ColumnDefault("0")
    private float tauxParcelleNonBati;
    private Long valeurAdministrativeParcelleNonBati;
    @JsonIgnore
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "impositions_tfu_id", nullable = false)
    private ImpositionsTfu impositionsTfu;
}
