package dev.lions.user.manager.dto.base;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.eclipse.microprofile.openapi.annotations.media.Schema;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * DTO de base pour tous les objets métier
 * Contient les attributs communs (id, dates, audit)
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@Schema(description = "DTO de base contenant les attributs communs à tous les objets")
public abstract class BaseDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "Identifiant unique (UUID Keycloak)", example = "f47ac10b-58cc-4372-a567-0e02b2c3d479")
    private String id;

    @Schema(description = "Date de création", example = "2025-01-15T10:30:00")
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime dateCreation;

    @Schema(description = "Date de dernière modification", example = "2025-01-15T14:20:00")
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime dateModification;

    @Schema(description = "Utilisateur ayant créé l'entité", example = "admin@lions.dev")
    private String creeParUsername;

    @Schema(description = "Utilisateur ayant modifié l'entité", example = "superadmin@lions.dev")
    private String modifieParUsername;

    @Schema(description = "Numéro de version pour gestion optimiste", example = "1")
    private Long version;
}
