/* 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 { ClientType } from './ClientType';
import {
    ClientTypeFromJSON,
    ClientTypeFromJSONTyped,
    ClientTypeToJSON,
    ClientTypeToJSONTyped,
} from './ClientType';

/**
 * 
 * @export
 * @interface Client
 */
export interface Client {
    /**
     * 
     * @type {string}
     * @memberof Client
     */
    id?: string;
    /**
     * 
     * @type {string}
     * @memberof Client
     */
    name: string | null;
    /**
     * 
     * @type {ClientType}
     * @memberof Client
     */
    type?: ClientType;
    /**
     * 
     * @type {string}
     * @memberof Client
     */
    organizationId?: string;
    /**
     * 
     * @type {boolean}
     * @memberof Client
     */
    trusted?: boolean;
    /**
     * 
     * @type {string}
     * @memberof Client
     */
    websiteUrl?: string | null;
    /**
     * 
     * @type {string}
     * @memberof Client
     */
    photoUrl?: string | null;
    /**
     * 
     * @type {string}
     * @memberof Client
     */
    backgroundUrl?: string | null;
    /**
     * 
     * @type {string}
     * @memberof Client
     */
    redirects?: string | null;
    /**
     * 
     * @type {string}
     * @memberof Client
     */
    scopes?: string | null;
    /**
     * 
     * @type {Array<string>}
     * @memberof Client
     */
    readonly permissions?: Array<string> | null;
    /**
     * 
     * @type {Date}
     * @memberof Client
     */
    created?: Date;
    /**
     * 
     * @type {Date}
     * @memberof Client
     */
    updated?: Date | null;
}



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

export function ClientFromJSON(json: any): Client {
    return ClientFromJSONTyped(json, false);
}

export function ClientFromJSONTyped(json: any, ignoreDiscriminator: boolean): Client {
    if (json == null) {
        return json;
    }
    return {
        
        'id': json['id'] == null ? undefined : json['id'],
        'name': json['name'],
        'type': json['type'] == null ? undefined : ClientTypeFromJSON(json['type']),
        'organizationId': json['organization_id'] == null ? undefined : json['organization_id'],
        'trusted': json['trusted'] == null ? undefined : json['trusted'],
        'websiteUrl': json['website_url'] == null ? undefined : json['website_url'],
        'photoUrl': json['photo_url'] == null ? undefined : json['photo_url'],
        'backgroundUrl': json['background_url'] == null ? undefined : json['background_url'],
        'redirects': json['redirects'] == null ? undefined : json['redirects'],
        'scopes': json['scopes'] == null ? undefined : json['scopes'],
        'permissions': json['permissions'] == null ? undefined : json['permissions'],
        'created': json['created'] == null ? undefined : (new Date(json['created'])),
        'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
    };
}

export function ClientToJSON(json: any): Client {
    return ClientToJSONTyped(json, false);
}

export function ClientToJSONTyped(value?: Omit<Client, 'permissions'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'id': value['id'],
        'name': value['name'],
        'type': ClientTypeToJSON(value['type']),
        'organization_id': value['organizationId'],
        'trusted': value['trusted'],
        'website_url': value['websiteUrl'],
        'photo_url': value['photoUrl'],
        'background_url': value['backgroundUrl'],
        'redirects': value['redirects'],
        'scopes': value['scopes'],
        'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
        'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
    };
}

