/* 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 { ContentTypeEnum } from "./ContentTypeEnum";
import { ContentTypeEnumFromJSON, ContentTypeEnumToJSON } from "./ContentTypeEnum";
import type { LifecycleIterationStateEnum } from "./LifecycleIterationStateEnum";
import { LifecycleIterationStateEnumFromJSON } from "./LifecycleIterationStateEnum";
import type { Review } from "./Review";
import { ReviewFromJSON } from "./Review";
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 LifecycleIteration
 */
export interface LifecycleIteration {
    /**
     *
     * @type {string}
     * @memberof LifecycleIteration
     */
    readonly id: string;
    /**
     *
     * @type {ContentTypeEnum}
     * @memberof LifecycleIteration
     */
    contentType: ContentTypeEnum;
    /**
     *
     * @type {string}
     * @memberof LifecycleIteration
     */
    readonly objectId: string;
    /**
     *
     * @type {string}
     * @memberof LifecycleIteration
     */
    readonly objectVerbose: string;
    /**
     *
     * @type {string}
     * @memberof LifecycleIteration
     */
    readonly objectAdminUrl: string;
    /**
     *
     * @type {LifecycleIterationStateEnum}
     * @memberof LifecycleIteration
     */
    readonly state: LifecycleIterationStateEnum;
    /**
     *
     * @type {Date}
     * @memberof LifecycleIteration
     */
    readonly openedOn: Date;
    /**
     *
     * @type {Date}
     * @memberof LifecycleIteration
     */
    readonly gracePeriodEnd: Date;
    /**
     *
     * @type {Date}
     * @memberof LifecycleIteration
     */
    readonly nextReviewDate: Date;
    /**
     *
     * @type {Array<Review>}
     * @memberof LifecycleIteration
     */
    readonly reviews: Array<Review>;
    /**
     *
     * @type {boolean}
     * @memberof LifecycleIteration
     */
    readonly userCanReview: boolean;
    /**
     *
     * @type {Array<ReviewerGroup>}
     * @memberof LifecycleIteration
     */
    readonly reviewerGroups: Array<ReviewerGroup>;
    /**
     *
     * @type {number}
     * @memberof LifecycleIteration
     */
    readonly minReviewers: number;
    /**
     *
     * @type {Array<ReviewerUser>}
     * @memberof LifecycleIteration
     */
    readonly reviewers: Array<ReviewerUser>;
}

/**
 * Check if a given object implements the LifecycleIteration interface.
 */
export function instanceOfLifecycleIteration(value: object): value is LifecycleIteration {
    if (!("id" in value) || value["id"] === undefined) return false;
    if (!("contentType" in value) || value["contentType"] === undefined) return false;
    if (!("objectId" in value) || value["objectId"] === undefined) return false;
    if (!("objectVerbose" in value) || value["objectVerbose"] === undefined) return false;
    if (!("objectAdminUrl" in value) || value["objectAdminUrl"] === undefined) return false;
    if (!("state" in value) || value["state"] === undefined) return false;
    if (!("openedOn" in value) || value["openedOn"] === undefined) return false;
    if (!("gracePeriodEnd" in value) || value["gracePeriodEnd"] === undefined) return false;
    if (!("nextReviewDate" in value) || value["nextReviewDate"] === undefined) return false;
    if (!("reviews" in value) || value["reviews"] === undefined) return false;
    if (!("userCanReview" in value) || value["userCanReview"] === 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 LifecycleIterationFromJSON(json: any): LifecycleIteration {
    return LifecycleIterationFromJSONTyped(json, false);
}

export function LifecycleIterationFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): LifecycleIteration {
    if (json == null) {
        return json;
    }
    return {
        id: json["id"],
        contentType: ContentTypeEnumFromJSON(json["content_type"]),
        objectId: json["object_id"],
        objectVerbose: json["object_verbose"],
        objectAdminUrl: json["object_admin_url"],
        state: LifecycleIterationStateEnumFromJSON(json["state"]),
        openedOn: new Date(json["opened_on"]),
        gracePeriodEnd: new Date(json["grace_period_end"]),
        nextReviewDate: new Date(json["next_review_date"]),
        reviews: (json["reviews"] as Array<any>).map(ReviewFromJSON),
        userCanReview: json["user_can_review"],
        reviewerGroups: (json["reviewer_groups"] as Array<any>).map(ReviewerGroupFromJSON),
        minReviewers: json["min_reviewers"],
        reviewers: (json["reviewers"] as Array<any>).map(ReviewerUserFromJSON),
    };
}

export function LifecycleIterationToJSON(json: any): LifecycleIteration {
    return LifecycleIterationToJSONTyped(json, false);
}

export function LifecycleIterationToJSONTyped(
    value?: Omit<
        LifecycleIteration,
        | "id"
        | "object_id"
        | "object_verbose"
        | "object_admin_url"
        | "state"
        | "opened_on"
        | "grace_period_end"
        | "next_review_date"
        | "reviews"
        | "user_can_review"
        | "reviewer_groups"
        | "min_reviewers"
        | "reviewers"
    > | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        content_type: ContentTypeEnumToJSON(value["contentType"]),
    };
}
