package br.gov.sigefp.budget.domain;

import br.gov.sigefp.common.domain.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
import lombok.experimental.SuperBuilder;

import java.time.LocalDate;

/**
 * Entidade que representa um ano fiscal.
 * Usa LocalDate para datas de início e fim.
 */
@Entity
@Table(name = "fiscal_year", indexes = {
        @Index(name = "idx_fiscal_year_year", columnList = "year"),
        @Index(name = "idx_fiscal_year_status", columnList = "status")
})
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class FiscalYear extends BaseEntity {

    @Column(nullable = false, unique = true)
    private Integer year;

    @Column(nullable = false, name = "start_date")
    private LocalDate startDate;

    @Column(nullable = false, name = "end_date")
    private LocalDate endDate;

    @Column(nullable = false, length = 20)
    @Builder.Default
    private String status = "OPEN"; // OPEN, CLOSED, PLANNING - preparado para enum
}
