/* tslint:disable */
/* eslint-disable */
/**
 * CWMS Data API
 * CWMS REST API for Data Retrieval
 *
 * The version of the OpenAPI document: 2.4.0-2026.3.16
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { exists, mapValues } from '../runtime';
/**
 * 
 * @export
 * @interface ApiKey
 */
export interface ApiKey {
    /**
     * 
     * @type {string}
     * @memberof ApiKey
     */
    userId: string;
    /**
     * 
     * @type {string}
     * @memberof ApiKey
     */
    keyName: string;
    /**
     * 
     * @type {string}
     * @memberof ApiKey
     */
    apiKey?: string;
    /**
     * The instant this Key was created, in ISO-8601 format with offset and timezone ('yyyy-MM-dd'T'HH:mm:ssZ'['VV']'')
     * @type {Date}
     * @memberof ApiKey
     */
    readonly created?: Date;
    /**
     * When this key expires, in ISO-8601 format with offset and timezone ('yyyy-MM-dd'T'HH:mm:ssZ'['VV']'')
     * @type {Date}
     * @memberof ApiKey
     */
    expires?: Date;
}

export function ApiKeyFromJSON(json: any): ApiKey {
    return ApiKeyFromJSONTyped(json, false);
}

export function ApiKeyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiKey {
    if ((json === undefined) || (json === null)) {
        return json;
    }
    return {
        
        'userId': json['user-id'],
        'keyName': json['key-name'],
        'apiKey': !exists(json, 'api-key') ? undefined : json['api-key'],
        'created': !exists(json, 'created') ? undefined : (new Date(json['created'])),
        'expires': !exists(json, 'expires') ? undefined : (new Date(json['expires'])),
    };
}

export function ApiKeyToJSON(value?: ApiKey | null): any {
    if (value === undefined) {
        return undefined;
    }
    if (value === null) {
        return null;
    }
    return {
        
        'user-id': value.userId,
        'key-name': value.keyName,
        'api-key': value.apiKey,
        'expires': value.expires === undefined ? undefined : (value.expires.toISOString()),
    };
}

