package com.reading.platform.common.enums;

import lombok.Getter;

/**
 * User Role Enum
 */
@Getter
public enum UserRole {

    ADMIN("admin", "Super Admin"),
    SCHOOL("school", "School Admin"),
    TEACHER("teacher", "Teacher"),
    PARENT("parent", "Parent");

    private final String code;
    private final String description;

    UserRole(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public static UserRole fromCode(String code) {
        for (UserRole role : values()) {
            if (role.getCode().equals(code)) {
                return role;
            }
        }
        throw new IllegalArgumentException("Unknown role code: " + code);
    }

}
