package br.gov.sigefp.rh.domain;

import br.gov.sigefp.common.domain.AuditableEntity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
import lombok.*;
import lombok.experimental.SuperBuilder;

/**
 * Entidade que representa um tipo de desconto/dedução.
 */
@Entity
@Table(name = "deduction_type", indexes = {
        @Index(name = "idx_deduction_type_code", columnList = "code")
})
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class DeductionType extends AuditableEntity {

    @Column(nullable = false, unique = true, length = 50)
    private String code;

    @Column(nullable = false, length = 200)
    private String name;

    @Column(nullable = false)
    @Builder.Default
    private Boolean mandatory = false; // Se o desconto é obrigatório

    @Column(length = 20, name = "economic_class_code")
    private String economicClassCode; // Classificador Económico

    @Column(nullable = false)
    @Builder.Default
    private Boolean active = true;
}
