/* 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 { LogEvent } from "./LogEvent";
import { LogEventFromJSON } from "./LogEvent";

/**
 * result of a policy test
 * @export
 * @interface PolicyTestResult
 */
export interface PolicyTestResult {
    /**
     *
     * @type {boolean}
     * @memberof PolicyTestResult
     */
    passing: boolean;
    /**
     *
     * @type {Array<string>}
     * @memberof PolicyTestResult
     */
    readonly messages: Array<string>;
    /**
     *
     * @type {Array<LogEvent>}
     * @memberof PolicyTestResult
     */
    readonly logMessages: Array<LogEvent>;
}

/**
 * Check if a given object implements the PolicyTestResult interface.
 */
export function instanceOfPolicyTestResult(value: object): value is PolicyTestResult {
    if (!("passing" in value) || value["passing"] === undefined) return false;
    if (!("messages" in value) || value["messages"] === undefined) return false;
    if (!("logMessages" in value) || value["logMessages"] === undefined) return false;
    return true;
}

export function PolicyTestResultFromJSON(json: any): PolicyTestResult {
    return PolicyTestResultFromJSONTyped(json, false);
}

export function PolicyTestResultFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PolicyTestResult {
    if (json == null) {
        return json;
    }
    return {
        passing: json["passing"],
        messages: json["messages"],
        logMessages: (json["log_messages"] as Array<any>).map(LogEventFromJSON),
    };
}

export function PolicyTestResultToJSON(json: any): PolicyTestResult {
    return PolicyTestResultToJSONTyped(json, false);
}

export function PolicyTestResultToJSONTyped(
    value?: Omit<PolicyTestResult, "messages" | "log_messages"> | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        passing: value["passing"],
    };
}
