/* 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 { ModelsUser } from "./ModelsUser";
import {
  ModelsUserFromJSON,
  ModelsUserFromJSONTyped,
  ModelsUserToJSON,
  ModelsUserToJSONTyped,
} from "./ModelsUser";

/**
 *
 * @export
 * @interface ModelsUserEmail
 */
export interface ModelsUserEmail {
  /**
   *
   * @type {Date}
   * @memberof ModelsUserEmail
   */
  created_at?: Date;
  /**
   *
   * @type {string}
   * @memberof ModelsUserEmail
   */
  email?: string;
  /**
   * example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
   * @type {string}
   * @memberof ModelsUserEmail
   */
  id?: string;
  /**
   *
   * @type {boolean}
   * @memberof ModelsUserEmail
   */
  is_primary?: boolean;
  /**
   *
   * @type {boolean}
   * @memberof ModelsUserEmail
   */
  is_verified?: boolean;
  /**
   *
   * @type {Date}
   * @memberof ModelsUserEmail
   */
  updated_at?: Date;
  /**
   *
   * @type {ModelsUser}
   * @memberof ModelsUserEmail
   */
  user?: ModelsUser;
  /**
   *
   * @type {string}
   * @memberof ModelsUserEmail
   */
  user_id?: string;
}

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

export function ModelsUserEmailFromJSON(json: any): ModelsUserEmail {
  return ModelsUserEmailFromJSONTyped(json, false);
}

export function ModelsUserEmailFromJSONTyped(
  json: any,
  ignoreDiscriminator: boolean,
): ModelsUserEmail {
  if (json == null) {
    return json;
  }
  return {
    created_at:
      json["created_at"] == null ? undefined : new Date(json["created_at"]),
    email: json["email"] == null ? undefined : json["email"],
    id: json["id"] == null ? undefined : json["id"],
    is_primary: json["is_primary"] == null ? undefined : json["is_primary"],
    is_verified: json["is_verified"] == null ? undefined : json["is_verified"],
    updated_at:
      json["updated_at"] == null ? undefined : new Date(json["updated_at"]),
    user: json["user"] == null ? undefined : ModelsUserFromJSON(json["user"]),
    user_id: json["user_id"] == null ? undefined : json["user_id"],
  };
}

export function ModelsUserEmailToJSON(json: any): ModelsUserEmail {
  return ModelsUserEmailToJSONTyped(json, false);
}

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

  return {
    created_at:
      value["created_at"] == null
        ? value["created_at"]
        : value["created_at"].toISOString(),
    email: value["email"],
    id: value["id"],
    is_primary: value["is_primary"],
    is_verified: value["is_verified"],
    updated_at:
      value["updated_at"] == null
        ? value["updated_at"]
        : value["updated_at"].toISOString(),
    user: ModelsUserToJSON(value["user"]),
    user_id: value["user_id"],
  };
}
