/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.12.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 { mapValues } from '../runtime';
import type { Permission } from './Permission';
import {
    PermissionFromJSON,
    PermissionFromJSONTyped,
    PermissionToJSON,
    PermissionToJSONTyped,
} from './Permission';
import type { InitialPermissionsModeEnum } from './InitialPermissionsModeEnum';
import {
    InitialPermissionsModeEnumFromJSON,
    InitialPermissionsModeEnumFromJSONTyped,
    InitialPermissionsModeEnumToJSON,
    InitialPermissionsModeEnumToJSONTyped,
} from './InitialPermissionsModeEnum';

/**
 * InitialPermissions serializer
 * @export
 * @interface InitialPermissions
 */
export interface InitialPermissions {
    /**
     * 
     * @type {number}
     * @memberof InitialPermissions
     */
    readonly pk: number;
    /**
     * 
     * @type {string}
     * @memberof InitialPermissions
     */
    name: string;
    /**
     * 
     * @type {InitialPermissionsModeEnum}
     * @memberof InitialPermissions
     */
    mode: InitialPermissionsModeEnum;
    /**
     * 
     * @type {string}
     * @memberof InitialPermissions
     */
    role: string;
    /**
     * 
     * @type {Array<number>}
     * @memberof InitialPermissions
     */
    permissions?: Array<number>;
    /**
     * 
     * @type {Array<Permission>}
     * @memberof InitialPermissions
     */
    readonly permissionsObj: Array<Permission>;
}



/**
 * Check if a given object implements the InitialPermissions interface.
 */
export function instanceOfInitialPermissions(value: object): value is InitialPermissions {
    if (!('pk' in value) || value['pk'] === undefined) return false;
    if (!('name' in value) || value['name'] === undefined) return false;
    if (!('mode' in value) || value['mode'] === undefined) return false;
    if (!('role' in value) || value['role'] === undefined) return false;
    if (!('permissionsObj' in value) || value['permissionsObj'] === undefined) return false;
    return true;
}

export function InitialPermissionsFromJSON(json: any): InitialPermissions {
    return InitialPermissionsFromJSONTyped(json, false);
}

export function InitialPermissionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): InitialPermissions {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        'name': json['name'],
        'mode': InitialPermissionsModeEnumFromJSON(json['mode']),
        'role': json['role'],
        'permissions': json['permissions'] == null ? undefined : json['permissions'],
        'permissionsObj': ((json['permissions_obj'] as Array<any>).map(PermissionFromJSON)),
    };
}

export function InitialPermissionsToJSON(json: any): InitialPermissions {
    return InitialPermissionsToJSONTyped(json, false);
}

export function InitialPermissionsToJSONTyped(value?: Omit<InitialPermissions, 'pk'|'permissions_obj'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'name': value['name'],
        'mode': InitialPermissionsModeEnumToJSON(value['mode']),
        'role': value['role'],
        'permissions': value['permissions'],
    };
}

