/* 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 Ticket
 */
export interface Ticket {
  /**
   *
   * @type {string}
   * @memberof Ticket
   */
  id: string
  /**
   *
   * @type {string}
   * @memberof Ticket
   */
  type: string
  /**
   *
   * @type {string}
   * @memberof Ticket
   */
  name: string
  /**
   *
   * @type {string}
   * @memberof Ticket
   */
  description: string
  /**
   *
   * @type {boolean}
   * @memberof Ticket
   */
  open: boolean
  /**
   *
   * @type {string}
   * @memberof Ticket
   */
  owner?: string
  /**
   *
   * @type {string}
   * @memberof Ticket
   */
  resolution?: string
  /**
   *
   * @type {object}
   * @memberof Ticket
   */
  schema: object
  /**
   *
   * @type {object}
   * @memberof Ticket
   */
  state: object
  /**
   *
   * @type {Date}
   * @memberof Ticket
   */
  created: Date
  /**
   *
   * @type {Date}
   * @memberof Ticket
   */
  updated: Date
}

/**
 * Check if a given object implements the Ticket interface.
 */
export function instanceOfTicket(value: object): value is Ticket {
  if (!('id' in value) || value['id'] === undefined) return false
  if (!('type' in value) || value['type'] === undefined) return false
  if (!('name' in value) || value['name'] === undefined) return false
  if (!('description' in value) || value['description'] === undefined) return false
  if (!('open' in value) || value['open'] === undefined) return false
  if (!('schema' in value) || value['schema'] === undefined) return false
  if (!('state' in value) || value['state'] === 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 TicketFromJSON(json: any): Ticket {
  return TicketFromJSONTyped(json, false)
}

export function TicketFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ticket {
  if (json == null) {
    return json
  }
  return {
    id: json['id'],
    type: json['type'],
    name: json['name'],
    description: json['description'],
    open: json['open'],
    owner: json['owner'] == null ? undefined : json['owner'],
    resolution: json['resolution'] == null ? undefined : json['resolution'],
    schema: json['schema'],
    state: json['state'],
    created: new Date(json['created']),
    updated: new Date(json['updated'])
  }
}

export function TicketToJSON(json: any): Ticket {
  return TicketToJSONTyped(json, false)
}

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

  return {
    id: value['id'],
    type: value['type'],
    name: value['name'],
    description: value['description'],
    open: value['open'],
    owner: value['owner'],
    resolution: value['resolution'],
    schema: value['schema'],
    state: value['state'],
    created: value['created'].toISOString(),
    updated: value['updated'].toISOString()
  }
}
