package kr.co.accura.wbx.spring.rbac;

import jakarta.persistence.*;
import lombok.*;

@Entity
@Table(name = "wbx_role_permissions",
        uniqueConstraints = @UniqueConstraint(columnNames = {"role_id", "module", "action"}))
@Getter @Setter
@NoArgsConstructor @AllArgsConstructor @Builder
public class RolePermission {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "role_id", nullable = false)
    private Long roleId;

    @Column(nullable = false, length = 50)
    private String module;

    @Column(nullable = false, length = 30)
    private String action;

    @Enumerated(EnumType.STRING)
    @Column(name = "dept_scope", length = 10)
    @Builder.Default
    private DeptScope deptScope = DeptScope.OWN;
}
