/* tslint:disable */
/* eslint-disable */
/**
 * Ticketing System API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 *
 *
 * 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 User
 */
export interface User {
  /**
   *
   * @type {string}
   * @memberof User
   */
  id: string
  /**
   *
   * @type {string}
   * @memberof User
   */
  username: string
  /**
   *
   * @type {string}
   * @memberof User
   */
  avatar?: string
  /**
   *
   * @type {string}
   * @memberof User
   */
  email?: string
  /**
   *
   * @type {Date}
   * @memberof User
   */
  lastResetSentAt?: Date
  /**
   *
   * @type {Date}
   * @memberof User
   */
  lastVerificationSentAt?: Date
  /**
   *
   * @type {string}
   * @memberof User
   */
  name?: string
  /**
   *
   * @type {boolean}
   * @memberof User
   */
  active: boolean
  /**
   *
   * @type {Date}
   * @memberof User
   */
  created: Date
  /**
   *
   * @type {Date}
   * @memberof User
   */
  updated: Date
}

/**
 * Check if a given object implements the User interface.
 */
export function instanceOfUser(value: object): value is User {
  if (!('id' in value) || value['id'] === undefined) return false
  if (!('username' in value) || value['username'] === undefined) return false
  if (!('active' in value) || value['active'] === undefined) return false
  if (!('created' in value) || value['created'] === undefined) return false
  if (!('updated' in value) || value['updated'] === undefined) return false
  return true
}

export function UserFromJSON(json: any): User {
  return UserFromJSONTyped(json, false)
}

export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User {
  if (json == null) {
    return json
  }
  return {
    id: json['id'],
    username: json['username'],
    avatar: json['avatar'] == null ? undefined : json['avatar'],
    email: json['email'] == null ? undefined : json['email'],
    lastResetSentAt:
      json['lastResetSentAt'] == null ? undefined : new Date(json['lastResetSentAt']),
    lastVerificationSentAt:
      json['lastVerificationSentAt'] == null ? undefined : new Date(json['lastVerificationSentAt']),
    name: json['name'] == null ? undefined : json['name'],
    active: json['active'],
    created: new Date(json['created']),
    updated: new Date(json['updated'])
  }
}

export function UserToJSON(json: any): User {
  return UserToJSONTyped(json, false)
}

export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any {
  if (value == null) {
    return value
  }

  return {
    id: value['id'],
    username: value['username'],
    avatar: value['avatar'],
    email: value['email'],
    lastResetSentAt:
      value['lastResetSentAt'] == null ? undefined : value['lastResetSentAt'].toISOString(),
    lastVerificationSentAt:
      value['lastVerificationSentAt'] == null
        ? undefined
        : value['lastVerificationSentAt'].toISOString(),
    name: value['name'],
    active: value['active'],
    created: value['created'].toISOString(),
    updated: value['updated'].toISOString()
  }
}
