001package jmri;
002
003import java.util.Comparator;
004
005import javax.annotation.Nonnull;
006
007/**
008 * Defines a permission.
009 *
010 * @author Daniel Bergqvist (C) 2024
011 */
012public interface Permission extends Comparator<PermissionValue> {
013
014    /**
015     * Get the owner
016     * @return the owner
017     */
018    @Nonnull
019    PermissionOwner getOwner();
020
021    /**
022     * Get the name of the permission
023     * @return the name
024     */
025    @Nonnull
026    String getName();
027
028    String getValue(PermissionValue value);
029
030    PermissionValue valueOf(String value);
031
032    /**
033     * Get the default permission if the user has no role.
034     * @return the default
035     */
036    PermissionValue getDefaultPermission();
037
038    /**
039     * Get the default permission for a role.
040     * @param role the role
041     * @return the default
042     */
043    PermissionValue getDefaultPermission(Role role);
044
045}