/* 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 { PartialUser } from './PartialUser';
import {
    PartialUserFromJSON,
    PartialUserFromJSONTyped,
    PartialUserToJSON,
    PartialUserToJSONTyped,
} from './PartialUser';
import type { Role } from './Role';
import {
    RoleFromJSON,
    RoleFromJSONTyped,
    RoleToJSON,
    RoleToJSONTyped,
} from './Role';
import type { GroupChild } from './GroupChild';
import {
    GroupChildFromJSON,
    GroupChildFromJSONTyped,
    GroupChildToJSON,
    GroupChildToJSONTyped,
} from './GroupChild';

/**
 * Group Serializer
 * @export
 * @interface Group
 */
export interface Group {
    /**
     * 
     * @type {string}
     * @memberof Group
     */
    readonly pk: string;
    /**
     * 
     * @type {number}
     * @memberof Group
     */
    readonly numPk: number;
    /**
     * 
     * @type {string}
     * @memberof Group
     */
    name: string;
    /**
     * Users added to this group will be superusers.
     * @type {boolean}
     * @memberof Group
     */
    isSuperuser?: boolean;
    /**
     * 
     * @type {string}
     * @memberof Group
     */
    parent?: string | null;
    /**
     * 
     * @type {string}
     * @memberof Group
     */
    readonly parentName: string | null;
    /**
     * 
     * @type {Array<number>}
     * @memberof Group
     */
    users?: Array<number>;
    /**
     * 
     * @type {Array<PartialUser>}
     * @memberof Group
     */
    readonly usersObj: Array<PartialUser> | null;
    /**
     * 
     * @type {{ [key: string]: any; }}
     * @memberof Group
     */
    attributes?: { [key: string]: any; };
    /**
     * 
     * @type {Array<string>}
     * @memberof Group
     */
    roles?: Array<string>;
    /**
     * 
     * @type {Array<Role>}
     * @memberof Group
     */
    readonly rolesObj: Array<Role>;
    /**
     * 
     * @type {Array<string>}
     * @memberof Group
     */
    children?: Array<string>;
    /**
     * 
     * @type {Array<GroupChild>}
     * @memberof Group
     */
    readonly childrenObj: Array<GroupChild> | null;
}

/**
 * Check if a given object implements the Group interface.
 */
export function instanceOfGroup(value: object): value is Group {
    if (!('pk' in value) || value['pk'] === undefined) return false;
    if (!('numPk' in value) || value['numPk'] === undefined) return false;
    if (!('name' in value) || value['name'] === undefined) return false;
    if (!('parentName' in value) || value['parentName'] === undefined) return false;
    if (!('usersObj' in value) || value['usersObj'] === undefined) return false;
    if (!('rolesObj' in value) || value['rolesObj'] === undefined) return false;
    if (!('childrenObj' in value) || value['childrenObj'] === undefined) return false;
    return true;
}

export function GroupFromJSON(json: any): Group {
    return GroupFromJSONTyped(json, false);
}

export function GroupFromJSONTyped(json: any, ignoreDiscriminator: boolean): Group {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        'numPk': json['num_pk'],
        'name': json['name'],
        'isSuperuser': json['is_superuser'] == null ? undefined : json['is_superuser'],
        'parent': json['parent'] == null ? undefined : json['parent'],
        'parentName': json['parent_name'],
        'users': json['users'] == null ? undefined : json['users'],
        'usersObj': (json['users_obj'] == null ? null : (json['users_obj'] as Array<any>).map(PartialUserFromJSON)),
        'attributes': json['attributes'] == null ? undefined : json['attributes'],
        'roles': json['roles'] == null ? undefined : json['roles'],
        'rolesObj': ((json['roles_obj'] as Array<any>).map(RoleFromJSON)),
        'children': json['children'] == null ? undefined : json['children'],
        'childrenObj': (json['children_obj'] == null ? null : (json['children_obj'] as Array<any>).map(GroupChildFromJSON)),
    };
}

export function GroupToJSON(json: any): Group {
    return GroupToJSONTyped(json, false);
}

export function GroupToJSONTyped(value?: Omit<Group, 'pk'|'num_pk'|'parent_name'|'users_obj'|'roles_obj'|'children_obj'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'name': value['name'],
        'is_superuser': value['isSuperuser'],
        'parent': value['parent'],
        'users': value['users'],
        'attributes': value['attributes'],
        'roles': value['roles'],
        'children': value['children'],
    };
}

