/* 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.
 */

import type { AppEnum } from "./AppEnum";
import { AppEnumFromJSON, AppEnumToJSON } from "./AppEnum";
import type { EventActions } from "./EventActions";
import { EventActionsFromJSON, EventActionsToJSON } from "./EventActions";
import type { ModelEnum } from "./ModelEnum";
import { ModelEnumFromJSON, ModelEnumToJSON } from "./ModelEnum";

/**
 * Event Matcher Policy Serializer
 * @export
 * @interface PatchedEventMatcherPolicyRequest
 */
export interface PatchedEventMatcherPolicyRequest {
    /**
     *
     * @type {string}
     * @memberof PatchedEventMatcherPolicyRequest
     */
    name?: string;
    /**
     * When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.
     * @type {boolean}
     * @memberof PatchedEventMatcherPolicyRequest
     */
    executionLogging?: boolean;
    /**
     * Match created events with this action type. When left empty, all action types will be matched.
     * @type {EventActions}
     * @memberof PatchedEventMatcherPolicyRequest
     */
    action?: EventActions | null;
    /**
     * Matches Event's Client IP (strict matching, for network matching use an Expression Policy)
     * @type {string}
     * @memberof PatchedEventMatcherPolicyRequest
     */
    clientIp?: string | null;
    /**
     * Match events created by selected application. When left empty, all applications are matched.
     * @type {AppEnum}
     * @memberof PatchedEventMatcherPolicyRequest
     */
    app?: AppEnum | null;
    /**
     * Match events created by selected model. When left empty, all models are matched. When an app is selected, all the application's models are matched.
     * @type {ModelEnum}
     * @memberof PatchedEventMatcherPolicyRequest
     */
    model?: ModelEnum | null;
    /**
     *
     * @type {string}
     * @memberof PatchedEventMatcherPolicyRequest
     */
    query?: string | null;
}

/**
 * Check if a given object implements the PatchedEventMatcherPolicyRequest interface.
 */
export function instanceOfPatchedEventMatcherPolicyRequest(
    value: object,
): value is PatchedEventMatcherPolicyRequest {
    return true;
}

export function PatchedEventMatcherPolicyRequestFromJSON(
    json: any,
): PatchedEventMatcherPolicyRequest {
    return PatchedEventMatcherPolicyRequestFromJSONTyped(json, false);
}

export function PatchedEventMatcherPolicyRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PatchedEventMatcherPolicyRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"] == null ? undefined : json["name"],
        executionLogging: json["execution_logging"] == null ? undefined : json["execution_logging"],
        action: json["action"] == null ? undefined : EventActionsFromJSON(json["action"]),
        clientIp: json["client_ip"] == null ? undefined : json["client_ip"],
        app: json["app"] == null ? undefined : AppEnumFromJSON(json["app"]),
        model: json["model"] == null ? undefined : ModelEnumFromJSON(json["model"]),
        query: json["query"] == null ? undefined : json["query"],
    };
}

export function PatchedEventMatcherPolicyRequestToJSON(
    json: any,
): PatchedEventMatcherPolicyRequest {
    return PatchedEventMatcherPolicyRequestToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        execution_logging: value["executionLogging"],
        action: EventActionsToJSON(value["action"]),
        client_ip: value["clientIp"],
        app: AppEnumToJSON(value["app"]),
        model: ModelEnumToJSON(value["model"]),
        query: value["query"],
    };
}
