/* 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";
import type { ModelsUserEmail } from "./ModelsUserEmail";
import {
  ModelsUserEmailFromJSON,
  ModelsUserEmailFromJSONTyped,
  ModelsUserEmailToJSON,
  ModelsUserEmailToJSONTyped,
} from "./ModelsUserEmail";
import type { ModelsOrganization } from "./ModelsOrganization";
import {
  ModelsOrganizationFromJSON,
  ModelsOrganizationFromJSONTyped,
  ModelsOrganizationToJSON,
  ModelsOrganizationToJSONTyped,
} from "./ModelsOrganization";

/**
 *
 * @export
 * @interface HandlersMeResponse
 */
export interface HandlersMeResponse {
  /**
   *
   * @type {string}
   * @memberof HandlersMeResponse
   */
  avatar_url?: string;
  /**
   *
   * @type {Date}
   * @memberof HandlersMeResponse
   */
  created_at?: Date;
  /**
   *
   * @type {string}
   * @memberof HandlersMeResponse
   */
  display_name?: string;
  /**
   *
   * @type {Array<ModelsUserEmail>}
   * @memberof HandlersMeResponse
   */
  emails?: Array<ModelsUserEmail>;
  /**
   * example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
   * @type {string}
   * @memberof HandlersMeResponse
   */
  id?: string;
  /**
   *
   * @type {boolean}
   * @memberof HandlersMeResponse
   */
  is_admin?: boolean;
  /**
   *
   * @type {boolean}
   * @memberof HandlersMeResponse
   */
  is_disabled?: boolean;
  /**
   *
   * @type {Array<ModelsOrganization>}
   * @memberof HandlersMeResponse
   */
  organizations?: Array<ModelsOrganization>;
  /**
   *
   * @type {string}
   * @memberof HandlersMeResponse
   */
  primary_email?: string;
  /**
   *
   * @type {Date}
   * @memberof HandlersMeResponse
   */
  updated_at?: Date;
}

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

export function HandlersMeResponseFromJSON(json: any): HandlersMeResponse {
  return HandlersMeResponseFromJSONTyped(json, false);
}

export function HandlersMeResponseFromJSONTyped(
  json: any,
  ignoreDiscriminator: boolean,
): HandlersMeResponse {
  if (json == null) {
    return json;
  }
  return {
    avatar_url: json["avatar_url"] == null ? undefined : json["avatar_url"],
    created_at:
      json["created_at"] == null ? undefined : new Date(json["created_at"]),
    display_name:
      json["display_name"] == null ? undefined : json["display_name"],
    emails:
      json["emails"] == null
        ? undefined
        : (json["emails"] as Array<any>).map(ModelsUserEmailFromJSON),
    id: json["id"] == null ? undefined : json["id"],
    is_admin: json["is_admin"] == null ? undefined : json["is_admin"],
    is_disabled: json["is_disabled"] == null ? undefined : json["is_disabled"],
    organizations:
      json["organizations"] == null
        ? undefined
        : (json["organizations"] as Array<any>).map(ModelsOrganizationFromJSON),
    primary_email:
      json["primary_email"] == null ? undefined : json["primary_email"],
    updated_at:
      json["updated_at"] == null ? undefined : new Date(json["updated_at"]),
  };
}

export function HandlersMeResponseToJSON(json: any): HandlersMeResponse {
  return HandlersMeResponseToJSONTyped(json, false);
}

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

  return {
    avatar_url: value["avatar_url"],
    created_at:
      value["created_at"] == null
        ? value["created_at"]
        : value["created_at"].toISOString(),
    display_name: value["display_name"],
    emails:
      value["emails"] == null
        ? undefined
        : (value["emails"] as Array<any>).map(ModelsUserEmailToJSON),
    id: value["id"],
    is_admin: value["is_admin"],
    is_disabled: value["is_disabled"],
    organizations:
      value["organizations"] == null
        ? undefined
        : (value["organizations"] as Array<any>).map(ModelsOrganizationToJSON),
    primary_email: value["primary_email"],
    updated_at:
      value["updated_at"] == null
        ? value["updated_at"]
        : value["updated_at"].toISOString(),
  };
}
