/* 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 Webhook
 */
export interface Webhook {
  /**
   *
   * @type {string}
   * @memberof Webhook
   */
  id: string
  /**
   *
   * @type {string}
   * @memberof Webhook
   */
  name: string
  /**
   *
   * @type {string}
   * @memberof Webhook
   */
  collection: string
  /**
   *
   * @type {string}
   * @memberof Webhook
   */
  destination: string
  /**
   *
   * @type {Date}
   * @memberof Webhook
   */
  created: Date
  /**
   *
   * @type {Date}
   * @memberof Webhook
   */
  updated: Date
}

/**
 * Check if a given object implements the Webhook interface.
 */
export function instanceOfWebhook(value: object): value is Webhook {
  if (!('id' in value) || value['id'] === undefined) return false
  if (!('name' in value) || value['name'] === undefined) return false
  if (!('collection' in value) || value['collection'] === undefined) return false
  if (!('destination' in value) || value['destination'] === 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 WebhookFromJSON(json: any): Webhook {
  return WebhookFromJSONTyped(json, false)
}

export function WebhookFromJSONTyped(json: any, ignoreDiscriminator: boolean): Webhook {
  if (json == null) {
    return json
  }
  return {
    id: json['id'],
    name: json['name'],
    collection: json['collection'],
    destination: json['destination'],
    created: new Date(json['created']),
    updated: new Date(json['updated'])
  }
}

export function WebhookToJSON(json: any): Webhook {
  return WebhookToJSONTyped(json, false)
}

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

  return {
    id: value['id'],
    name: value['name'],
    collection: value['collection'],
    destination: value['destination'],
    created: value['created'].toISOString(),
    updated: value['updated'].toISOString()
  }
}
