package dev.lions.user.manager.server.impl.entity;

import io.quarkus.hibernate.orm.panache.PanacheEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Index;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * Snapshot local d'un rôle Keycloak synchronisé.
 */
@Entity
@Table(name = "synced_role", indexes = {
        @Index(name = "idx_synced_role_realm", columnList = "realm_name"),
        @Index(name = "idx_synced_role_realm_name", columnList = "realm_name,role_name", unique = true)
})
@Data
@EqualsAndHashCode(callSuper = true)
public class SyncedRoleEntity extends PanacheEntity {

    @Column(name = "realm_name", nullable = false)
    private String realmName;

    @Column(name = "role_name", nullable = false)
    private String roleName;

    @Column(name = "description")
    private String description;
}

