package dev.lions.unionflow.server.api.dto.finance_workflow.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * DTO de réponse pour une approbation de transaction
 *
 * @author UnionFlow Team
 * @version 1.0
 * @since 2026-03-13
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TransactionApprovalResponse {

    private UUID id;

    @NotNull
    private UUID transactionId;

    @NotBlank
    private String transactionType; // CONTRIBUTION, DEPOSIT, WITHDRAWAL, etc.

    @NotNull
    private BigDecimal amount;

    @NotBlank
    private String currency;

    @NotNull
    private UUID requesterId;

    @NotBlank
    private String requesterName;

    private UUID organizationId;

    @NotBlank
    private String requiredLevel; // NONE, LEVEL1, LEVEL2, LEVEL3

    @NotBlank
    private String status; // PENDING, APPROVED, VALIDATED, REJECTED, EXPIRED, CANCELLED

    @Builder.Default
    private List<ApproverActionResponse> approvers = new ArrayList<>();

    private String rejectionReason;

    @NotNull
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime createdAt;

    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime expiresAt;

    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime completedAt;

    private String metadata;

    // Champs calculés
    private Integer approvalCount;
    private Integer requiredApprovals;
    private Boolean hasAllApprovals;
    private Boolean isExpired;
    private Boolean isPending;
    private Boolean isCompleted;
}
