package br.gov.sigefp.org.domain;

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

/**
 * Entidade que representa uma posição/cargo dentro de uma unidade organizacional.
 */
@Entity
@Table(name = "position", indexes = {
    @Index(name = "idx_position_code", columnList = "code"),
    @Index(name = "idx_position_org_unit", columnList = "org_unit_id")
})
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Position extends BaseEntity {

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "org_unit_id", nullable = false)
    private OrgUnit orgUnit;

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

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

    @Column(length = 50)
    private String level;

    @Column(nullable = false, name = "is_active")
    @Builder.Default
    private Boolean isActive = true;
}

