package incheon.com.security.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 역할 체크 어노테이션 (AOP 방식)
 *
 * 사용법:
 * {@literal @}RequireRole(system = "AGS", roles = "ROLE_SUPER_ADMIN")
 * {@literal @}RequireRole(system = "AGS", roles = {"ROLE_ADMIN", "ROLE_MANAGER"})
 * {@literal @}RequireRole(system = "AGS", roles = {"ROLE_1", "ROLE_2"}, requireAll = true)
 */
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RequireRole {

    /** 시스템 코드 */
    String system();

    /** 역할 코드 (OR 조건) */
    String[] roles();

    /** 역할 설명 (선택) */
    String description() default "";

    /** 모든 역할 필요 (AND 조건) */
    boolean requireAll() default false;
}
