001/*
002 * Copyright 2026 Revetware LLC.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package com.revetsec.scim;
018
019import org.jspecify.annotations.NonNull;
020
021import javax.annotation.concurrent.Immutable;
022
023/**
024 * Fixed SCIM error types and their wire spellings.
025 *
026 * @since 1.0.0
027 */
028@Immutable
029public enum ScimErrorType {
030    /** A filter is malformed or unsupported. */ INVALID_FILTER("invalidFilter"),
031    /** A request would return too many results. */ TOO_MANY("tooMany"),
032    /** An advertised uniqueness requirement was violated. */ UNIQUENESS("uniqueness"),
033    /** An attribute's mutability restriction was violated. */ MUTABILITY("mutability"),
034    /** A request's structure or syntax is invalid. */ INVALID_SYNTAX("invalidSyntax"),
035    /** An attribute path is malformed or unsupported. */ INVALID_PATH("invalidPath"),
036    /** A PATCH selector has no target. */ NO_TARGET("noTarget"),
037    /** A supplied value is invalid. */ INVALID_VALUE("invalidValue"),
038    /** A SCIM version is invalid. */ INVALID_VERSION("invalidVers"),
039    /** A sensitive operation is forbidden. */ SENSITIVE("sensitive"),
040    /** A pagination cursor is invalid. */ INVALID_CURSOR("invalidCursor"),
041    /** A pagination cursor has expired. */ EXPIRED_CURSOR("expiredCursor"),
042    /** A requested cursor page count is invalid. */ INVALID_COUNT("invalidCount");
043
044    private final @NonNull String value;
045
046    ScimErrorType(@NonNull String value) {
047        this.value = value;
048    }
049
050    /**
051     * Returns the fixed value of the SCIM {@code scimType} field.
052     *
053     * @return the wire spelling
054     * @since 1.0.0
055     */
056    public @NonNull String getValue() {
057        return value;
058    }
059}