export { AccessRule } from './AccessRule.js';
export { RateLimitingConfiguration } from './RateLimitingConfiguration.js';
import { Exception } from '../../exceptions/exception.js';
import { AllowAuthenticatedAccessRule } from './AllowAuthenticated.js';
import { AllowPublicAccessRule } from './AllowPublic.js';
import { MatchEmailDomainAccessRule } from './MatchEmailDomain.js';
import { MatchResourceOwnerAccessRule } from './MatchResourceOwner.js';
import { MatchUserPropertyAccessRule } from './MatchUserProperty.js';
import { MatchUserRoleAccessRule } from './MatchUserRole.js';
import { RateLimitRule } from './RateLimitRule.js';
export { AllowAuthenticatedAccessRule, AllowPublicAccessRule, MatchEmailDomainAccessRule, MatchResourceOwnerAccessRule, MatchUserPropertyAccessRule, MatchUserRoleAccessRule, RateLimitRule, };
/**
 * Restores an access rule from a schema.
 *
 * It is a helper function to restore access rules from a schema.
 *
 * @param schema The schema to restore the access rule from.
 * @returns The restored access rule.
 */
export function restoreAccessRule(schema) {
    switch (schema.type) {
        case 'allowAuthenticated':
            return new AllowAuthenticatedAccessRule(schema);
        case 'allowPublic':
            return new AllowPublicAccessRule(schema);
        case 'matchEmailDomain':
            return new MatchEmailDomainAccessRule(schema);
        case 'matchResourceOwner':
            return new MatchResourceOwnerAccessRule(schema);
        case 'matchUserProperty':
            return new MatchUserPropertyAccessRule(schema);
        case 'matchUserRole':
            return new MatchUserRoleAccessRule(schema);
        default:
            throw new Exception('Unknown access rule kind', {
                code: 'E_UNKNOWN_ACCESS_RULE_KIND',
                status: 422,
            });
    }
}
//# sourceMappingURL=index.js.map