/* tslint:disable */
/* eslint-disable */
/**
 * AutoGlue API
 * API for managing K3s clusters across cloud providers
 *
 * The version of the OpenAPI document: dev
 *
 *
 * 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";
/**
 *
 * @export
 * @interface ModelsAPIKey
 */
export interface ModelsAPIKey {
  /**
   *
   * @type {Date}
   * @memberof ModelsAPIKey
   */
  created_at?: Date;
  /**
   *
   * @type {Date}
   * @memberof ModelsAPIKey
   */
  expires_at?: Date;
  /**
   *
   * @type {string}
   * @memberof ModelsAPIKey
   */
  id?: string;
  /**
   *
   * @type {Date}
   * @memberof ModelsAPIKey
   */
  last_used_at?: Date;
  /**
   *
   * @type {string}
   * @memberof ModelsAPIKey
   */
  name?: string;
  /**
   *
   * @type {string}
   * @memberof ModelsAPIKey
   */
  org_id?: string;
  /**
   *
   * @type {string}
   * @memberof ModelsAPIKey
   */
  prefix?: string;
  /**
   *
   * @type {boolean}
   * @memberof ModelsAPIKey
   */
  revoked?: boolean;
  /**
   *
   * @type {string}
   * @memberof ModelsAPIKey
   */
  scope?: string;
  /**
   *
   * @type {Date}
   * @memberof ModelsAPIKey
   */
  updated_at?: Date;
  /**
   *
   * @type {string}
   * @memberof ModelsAPIKey
   */
  user_id?: string;
}

/**
 * Check if a given object implements the ModelsAPIKey interface.
 */
export function instanceOfModelsAPIKey(value: object): value is ModelsAPIKey {
  return true;
}

export function ModelsAPIKeyFromJSON(json: any): ModelsAPIKey {
  return ModelsAPIKeyFromJSONTyped(json, false);
}

export function ModelsAPIKeyFromJSONTyped(
  json: any,
  ignoreDiscriminator: boolean,
): ModelsAPIKey {
  if (json == null) {
    return json;
  }
  return {
    created_at:
      json["created_at"] == null ? undefined : new Date(json["created_at"]),
    expires_at:
      json["expires_at"] == null ? undefined : new Date(json["expires_at"]),
    id: json["id"] == null ? undefined : json["id"],
    last_used_at:
      json["last_used_at"] == null ? undefined : new Date(json["last_used_at"]),
    name: json["name"] == null ? undefined : json["name"],
    org_id: json["org_id"] == null ? undefined : json["org_id"],
    prefix: json["prefix"] == null ? undefined : json["prefix"],
    revoked: json["revoked"] == null ? undefined : json["revoked"],
    scope: json["scope"] == null ? undefined : json["scope"],
    updated_at:
      json["updated_at"] == null ? undefined : new Date(json["updated_at"]),
    user_id: json["user_id"] == null ? undefined : json["user_id"],
  };
}

export function ModelsAPIKeyToJSON(json: any): ModelsAPIKey {
  return ModelsAPIKeyToJSONTyped(json, false);
}

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

  return {
    created_at:
      value["created_at"] == null
        ? value["created_at"]
        : value["created_at"].toISOString(),
    expires_at:
      value["expires_at"] == null
        ? value["expires_at"]
        : value["expires_at"].toISOString(),
    id: value["id"],
    last_used_at:
      value["last_used_at"] == null
        ? value["last_used_at"]
        : value["last_used_at"].toISOString(),
    name: value["name"],
    org_id: value["org_id"],
    prefix: value["prefix"],
    revoked: value["revoked"],
    scope: value["scope"],
    updated_at:
      value["updated_at"] == null
        ? value["updated_at"]
        : value["updated_at"].toISOString(),
    user_id: value["user_id"],
  };
}
