/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.5.0-rc1
 * Contact: hello@goauthentik.io
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

/**
 * PolicyBinding Serializer
 * @export
 * @interface PolicyBindingRequest
 */
export interface PolicyBindingRequest {
    /**
     *
     * @type {string}
     * @memberof PolicyBindingRequest
     */
    policy?: string | null;
    /**
     *
     * @type {string}
     * @memberof PolicyBindingRequest
     */
    group?: string | null;
    /**
     *
     * @type {number}
     * @memberof PolicyBindingRequest
     */
    user?: number | null;
    /**
     *
     * @type {string}
     * @memberof PolicyBindingRequest
     */
    target: string;
    /**
     * Negates the outcome of the policy. Messages are unaffected.
     * @type {boolean}
     * @memberof PolicyBindingRequest
     */
    negate?: boolean;
    /**
     *
     * @type {boolean}
     * @memberof PolicyBindingRequest
     */
    enabled?: boolean;
    /**
     *
     * @type {number}
     * @memberof PolicyBindingRequest
     */
    order: number;
    /**
     * Timeout after which Policy execution is terminated.
     * @type {number}
     * @memberof PolicyBindingRequest
     */
    timeout?: number;
    /**
     * Result if the Policy execution fails.
     * @type {boolean}
     * @memberof PolicyBindingRequest
     */
    failureResult?: boolean;
}

/**
 * Check if a given object implements the PolicyBindingRequest interface.
 */
export function instanceOfPolicyBindingRequest(value: object): value is PolicyBindingRequest {
    if (!("target" in value) || value["target"] === undefined) return false;
    if (!("order" in value) || value["order"] === undefined) return false;
    return true;
}

export function PolicyBindingRequestFromJSON(json: any): PolicyBindingRequest {
    return PolicyBindingRequestFromJSONTyped(json, false);
}

export function PolicyBindingRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PolicyBindingRequest {
    if (json == null) {
        return json;
    }
    return {
        policy: json["policy"] == null ? undefined : json["policy"],
        group: json["group"] == null ? undefined : json["group"],
        user: json["user"] == null ? undefined : json["user"],
        target: json["target"],
        negate: json["negate"] == null ? undefined : json["negate"],
        enabled: json["enabled"] == null ? undefined : json["enabled"],
        order: json["order"],
        timeout: json["timeout"] == null ? undefined : json["timeout"],
        failureResult: json["failure_result"] == null ? undefined : json["failure_result"],
    };
}

export function PolicyBindingRequestToJSON(json: any): PolicyBindingRequest {
    return PolicyBindingRequestToJSONTyped(json, false);
}

export function PolicyBindingRequestToJSONTyped(
    value?: PolicyBindingRequest | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        policy: value["policy"],
        group: value["group"],
        user: value["user"],
        target: value["target"],
        negate: value["negate"],
        enabled: value["enabled"],
        order: value["order"],
        timeout: value["timeout"],
        failure_result: value["failureResult"],
    };
}
