package br.gov.sigefp.rh.domain;

import br.gov.sigefp.common.domain.AuditableEntity;
import jakarta.persistence.*;
import lombok.*;

import java.util.ArrayList;
import java.util.List;

/**
 * Entidade que representa um Regime de Carreira (ex: Regime Geral, Saúde,
 * Educação).
 * Agrupa categorias salariais por setor.
 */
@Entity
@Table(name = "career_regime", indexes = {
        @Index(name = "idx_career_regime_code", columnList = "code")
})
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CareerRegime extends AuditableEntity {

    @Column(nullable = false, unique = true, length = 50)
    private String code; // Ex: REG-GERAL, REG-SAUDE

    @Column(nullable = false, length = 200)
    private String name; // Ex: Regime Geral da Função Pública

    @Column(length = 500)
    private String description;

    @OneToMany(mappedBy = "regime", cascade = CascadeType.ALL)
    @Builder.Default
    private List<SalaryCategory> categories = new ArrayList<>();
}
