/* tslint:disable */
/* eslint-disable */
/**
 * Apideck
 * The Apideck OpenAPI Spec: SDK Optimized
 *
 * The version of the OpenAPI document: 10.13.0
 * Contact: support@apideck.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { exists } from '../runtime'
/**
 *
 * @export
 * @interface Address
 */
export interface Address {
  /**
   * Unique identifier for the address.
   * @type {string}
   * @memberof Address
   */
  id?: string | null
  /**
   * The type of address.
   * @type {string}
   * @memberof Address
   */
  type?: AddressType
  /**
   * The address string. Some APIs don't provide structured address data.
   * @type {string}
   * @memberof Address
   */
  string?: string | null
  /**
   * The name of the address.
   * @type {string}
   * @memberof Address
   */
  name?: string | null
  /**
   * Line 1 of the address e.g. number, street, suite, apt #, etc.
   * @type {string}
   * @memberof Address
   */
  line1?: string | null
  /**
   * Line 2 of the address
   * @type {string}
   * @memberof Address
   */
  line2?: string | null
  /**
   * Line 3 of the address
   * @type {string}
   * @memberof Address
   */
  line3?: string | null
  /**
   * Line 4 of the address
   * @type {string}
   * @memberof Address
   */
  line4?: string | null
  /**
   * Street number
   * @type {string}
   * @memberof Address
   */
  street_number?: string | null
  /**
   * Name of city.
   * @type {string}
   * @memberof Address
   */
  city?: string | null
  /**
   * Name of state
   * @type {string}
   * @memberof Address
   */
  state?: string | null
  /**
   * Zip code or equivalent.
   * @type {string}
   * @memberof Address
   */
  postal_code?: string | null
  /**
   * country code according to ISO 3166-1 alpha-2.
   * @type {string}
   * @memberof Address
   */
  country?: string | null
  /**
   * Latitude of the address
   * @type {string}
   * @memberof Address
   */
  latitude?: string | null
  /**
   * Longitude of the address
   * @type {string}
   * @memberof Address
   */
  longitude?: string | null
  /**
   * Address field that holds a sublocality, such as a county
   * @type {string}
   * @memberof Address
   */
  county?: string | null
  /**
   * Name of the contact person at the address
   * @type {string}
   * @memberof Address
   */
  contact_name?: string | null
  /**
   * Salutation of the contact person at the address
   * @type {string}
   * @memberof Address
   */
  salutation?: string | null
  /**
   * Phone number of the address
   * @type {string}
   * @memberof Address
   */
  phone_number?: string | null
  /**
   * Fax number of the address
   * @type {string}
   * @memberof Address
   */
  fax?: string | null
  /**
   * Email address of the address
   * @type {string}
   * @memberof Address
   */
  email?: string | null
  /**
   * Website of the address
   * @type {string}
   * @memberof Address
   */
  website?: string | null
  /**
   * Additional notes
   * @type {string}
   * @memberof Address
   */
  notes?: string | null
  /**
   * A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object.
   * @type {string}
   * @memberof Address
   */
  row_version?: string | null
}

/**
 * @export
 * @enum {string}
 */
export enum AddressType {
  primary = 'primary',
  secondary = 'secondary',
  home = 'home',
  office = 'office',
  shipping = 'shipping',
  billing = 'billing',
  other = 'other'
}

export function AddressFromJSON(json: any): Address {
  return AddressFromJSONTyped(json, false)
}

export function AddressFromJSONTyped(json: any, ignoreDiscriminator: boolean): Address {
  if (json === undefined || json === null) {
    return json
  }
  return {
    id: !exists(json, 'id') ? undefined : json['id'],
    type: !exists(json, 'type') ? undefined : json['type'],
    string: !exists(json, 'string') ? undefined : json['string'],
    name: !exists(json, 'name') ? undefined : json['name'],
    line1: !exists(json, 'line1') ? undefined : json['line1'],
    line2: !exists(json, 'line2') ? undefined : json['line2'],
    line3: !exists(json, 'line3') ? undefined : json['line3'],
    line4: !exists(json, 'line4') ? undefined : json['line4'],
    street_number: !exists(json, 'street_number') ? undefined : json['street_number'],
    city: !exists(json, 'city') ? undefined : json['city'],
    state: !exists(json, 'state') ? undefined : json['state'],
    postal_code: !exists(json, 'postal_code') ? undefined : json['postal_code'],
    country: !exists(json, 'country') ? undefined : json['country'],
    latitude: !exists(json, 'latitude') ? undefined : json['latitude'],
    longitude: !exists(json, 'longitude') ? undefined : json['longitude'],
    county: !exists(json, 'county') ? undefined : json['county'],
    contact_name: !exists(json, 'contact_name') ? undefined : json['contact_name'],
    salutation: !exists(json, 'salutation') ? undefined : json['salutation'],
    phone_number: !exists(json, 'phone_number') ? undefined : json['phone_number'],
    fax: !exists(json, 'fax') ? undefined : json['fax'],
    email: !exists(json, 'email') ? undefined : json['email'],
    website: !exists(json, 'website') ? undefined : json['website'],
    notes: !exists(json, 'notes') ? undefined : json['notes'],
    row_version: !exists(json, 'row_version') ? undefined : json['row_version']
  }
}

export function AddressToJSON(value?: Address | null): any {
  if (value === undefined) {
    return undefined
  }
  if (value === null) {
    return null
  }
  return {
    id: value.id,
    type: value.type,
    string: value.string,
    name: value.name,
    line1: value.line1,
    line2: value.line2,
    line3: value.line3,
    line4: value.line4,
    street_number: value.street_number,
    city: value.city,
    state: value.state,
    postal_code: value.postal_code,
    country: value.country,
    latitude: value.latitude,
    longitude: value.longitude,
    county: value.county,
    contact_name: value.contact_name,
    salutation: value.salutation,
    phone_number: value.phone_number,
    fax: value.fax,
    email: value.email,
    website: value.website,
    notes: value.notes,
    row_version: value.row_version
  }
}
