/* 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 EventMatcherPolicyRequest
 */
export interface EventMatcherPolicyRequest {
    /**
     *
     * @type {string}
     * @memberof EventMatcherPolicyRequest
     */
    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 EventMatcherPolicyRequest
     */
    executionLogging?: boolean;
    /**
     * Match created events with this action type. When left empty, all action types will be matched.
     * @type {EventActions}
     * @memberof EventMatcherPolicyRequest
     */
    action?: EventActions | null;
    /**
     * Matches Event's Client IP (strict matching, for network matching use an Expression Policy)
     * @type {string}
     * @memberof EventMatcherPolicyRequest
     */
    clientIp?: string | null;
    /**
     * Match events created by selected application. When left empty, all applications are matched.
     * @type {AppEnum}
     * @memberof EventMatcherPolicyRequest
     */
    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 EventMatcherPolicyRequest
     */
    model?: ModelEnum | null;
    /**
     *
     * @type {string}
     * @memberof EventMatcherPolicyRequest
     */
    query?: string | null;
}

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

export function EventMatcherPolicyRequestFromJSON(json: any): EventMatcherPolicyRequest {
    return EventMatcherPolicyRequestFromJSONTyped(json, false);
}

export function EventMatcherPolicyRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): EventMatcherPolicyRequest {
    if (json == null) {
        return json;
    }
    return {
        name: 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 EventMatcherPolicyRequestToJSON(json: any): EventMatcherPolicyRequest {
    return EventMatcherPolicyRequestToJSONTyped(json, false);
}

export function EventMatcherPolicyRequestToJSONTyped(
    value?: EventMatcherPolicyRequest | 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"],
    };
}
