/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.5.3
 * 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 { ReviewerGroup } from "./ReviewerGroup";
import { ReviewerGroupFromJSON } from "./ReviewerGroup";
import type { ReviewerUser } from "./ReviewerUser";
import { ReviewerUserFromJSON } from "./ReviewerUser";

/**
 * Mixin to validate that a valid enterprise license
 * exists before allowing to save the object
 * @export
 * @interface RelatedRule
 */
export interface RelatedRule {
    /**
     *
     * @type {string}
     * @memberof RelatedRule
     */
    id?: string;
    /**
     *
     * @type {string}
     * @memberof RelatedRule
     */
    name: string;
    /**
     *
     * @type {Array<ReviewerGroup>}
     * @memberof RelatedRule
     */
    readonly reviewerGroups: Array<ReviewerGroup>;
    /**
     *
     * @type {number}
     * @memberof RelatedRule
     */
    readonly minReviewers: number;
    /**
     *
     * @type {Array<ReviewerUser>}
     * @memberof RelatedRule
     */
    readonly reviewers: Array<ReviewerUser>;
}

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

export function RelatedRuleFromJSON(json: any): RelatedRule {
    return RelatedRuleFromJSONTyped(json, false);
}

export function RelatedRuleFromJSONTyped(json: any, ignoreDiscriminator: boolean): RelatedRule {
    if (json == null) {
        return json;
    }
    return {
        id: json["id"] == null ? undefined : json["id"],
        name: json["name"],
        reviewerGroups: (json["reviewer_groups"] as Array<any>).map(ReviewerGroupFromJSON),
        minReviewers: json["min_reviewers"],
        reviewers: (json["reviewers"] as Array<any>).map(ReviewerUserFromJSON),
    };
}

export function RelatedRuleToJSON(json: any): RelatedRule {
    return RelatedRuleToJSONTyped(json, false);
}

export function RelatedRuleToJSONTyped(
    value?: Omit<RelatedRule, "reviewer_groups" | "min_reviewers" | "reviewers"> | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        id: value["id"],
        name: value["name"],
    };
}
