/* tslint:disable */
/* eslint-disable */
/**
 * Tribufu API
 * API to access Tribufu services.
 *
 * The version of the OpenAPI document: 1.3.0
 * Contact: contact@tribufu.com
 *
 * 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 { Group } from './Group';
import {
    GroupFromJSON,
    GroupFromJSONTyped,
    GroupToJSON,
    GroupToJSONTyped,
} from './Group';
import type { Application } from './Application';
import {
    ApplicationFromJSON,
    ApplicationFromJSONTyped,
    ApplicationToJSON,
    ApplicationToJSONTyped,
} from './Application';

/**
 * 
 * @export
 * @interface GroupApplication
 */
export interface GroupApplication {
    /**
     * 
     * @type {string}
     * @memberof GroupApplication
     */
    groupId: string;
    /**
     * 
     * @type {Group}
     * @memberof GroupApplication
     */
    group?: Group;
    /**
     * 
     * @type {string}
     * @memberof GroupApplication
     */
    applicationId?: string;
    /**
     * 
     * @type {Application}
     * @memberof GroupApplication
     */
    application?: Application;
    /**
     * 
     * @type {any}
     * @memberof GroupApplication
     */
    stats?: any | null;
    /**
     * 
     * @type {Date}
     * @memberof GroupApplication
     */
    acquired?: Date;
    /**
     * 
     * @type {Date}
     * @memberof GroupApplication
     */
    lastUsed?: Date | null;
}

/**
 * Check if a given object implements the GroupApplication interface.
 */
export function instanceOfGroupApplication(value: object): value is GroupApplication {
    if (!('groupId' in value) || value['groupId'] === undefined) return false;
    return true;
}

export function GroupApplicationFromJSON(json: any): GroupApplication {
    return GroupApplicationFromJSONTyped(json, false);
}

export function GroupApplicationFromJSONTyped(json: any, ignoreDiscriminator: boolean): GroupApplication {
    if (json == null) {
        return json;
    }
    return {
        
        'groupId': json['group_id'],
        'group': json['group'] == null ? undefined : GroupFromJSON(json['group']),
        'applicationId': json['application_id'] == null ? undefined : json['application_id'],
        'application': json['application'] == null ? undefined : ApplicationFromJSON(json['application']),
        'stats': json['stats'] == null ? undefined : json['stats'],
        'acquired': json['acquired'] == null ? undefined : (new Date(json['acquired'])),
        'lastUsed': json['last_used'] == null ? undefined : (new Date(json['last_used'])),
    };
}

export function GroupApplicationToJSON(json: any): GroupApplication {
    return GroupApplicationToJSONTyped(json, false);
}

export function GroupApplicationToJSONTyped(value?: GroupApplication | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'group_id': value['groupId'],
        'group': GroupToJSON(value['group']),
        'application_id': value['applicationId'],
        'application': ApplicationToJSON(value['application']),
        'stats': value['stats'],
        'acquired': value['acquired'] == null ? undefined : ((value['acquired']).toISOString()),
        'last_used': value['lastUsed'] == null ? undefined : ((value['lastUsed'] as any).toISOString()),
    };
}

