package com.pmu.betengine.model; import com.fasterxml.jackson.annotation.JsonFormat; import com.pmu.betengine.model.statut.StatutAgent; import jakarta.persistence.*; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Pattern; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; @Entity @Data @Builder @NoArgsConstructor @AllArgsConstructor @Table(name = "agent") public class Agent { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String code; private String profile; private String principalCode; private String caisseProfile; private StatutAgent statut; private String zone; private String kiosk; private String fonction; @Pattern(regexp = "^\\d{2}/\\d{2}/\\d{4}$", message = "La date doit être au format dd/MM/yyyy") @JsonFormat(pattern = "dd/MM/yyyy", shape = JsonFormat.Shape.STRING) private LocalDate dateEmbauche; @NotBlank(message = "Le nom est obligatoire") private String nom; private String prenom; private String autresNoms; @Pattern(regexp = "^\\d{2}/\\d{2}/\\d{4}$", message = "La date de naissance doit être au format dd/MM/yyyy") @Column(name = "date_naissance", nullable = false) @JsonFormat(pattern = "dd/MM/yyyy", shape = JsonFormat.Shape.STRING) private LocalDate dateNaissance; private String lieuNaissance; private String ville; private String adresse; private Boolean autoriserAides; private String phone; private String pin; private Double limiteInferieure; private Double limiteSuperieure; private Double limiteParTransaction; private Double limiteMinAirtime; private Double limiteMaxAirtime; private Integer maxPeripheriques; private String limitId; // Légales private String nationalite; private String cni; private String cniDelivreeLe; private String cniDelivreeA; private String residence; private String autreAdresse1; private String statutMarital; private String epoux; private String autreTelephone; // Situation familiale @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "agent_famille", joinColumns = @JoinColumn(name = "agent_id"), inverseJoinColumns = @JoinColumn(name = "famille_id")) private List famille; // TPE assignés private String [] assignedTpeIds; @CreationTimestamp private LocalDateTime createdAt; @UpdateTimestamp private LocalDateTime updatedAt; private String createdBy; }