// Code generated by go-swagger; DO NOT EDIT.

// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package sf_gate_models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
)

// Contact contact
//
// swagger:model Contact
type Contact struct {

	// The primary account ID of this contact
	Accountid string `json:"accountid,omitempty"`

	// Assistant Name
	Assistantname string `json:"assistantname,omitempty"`

	// Asst. Phone
	Assistantphone string `json:"assistantphone,omitempty"`

	// Birthdate
	Birthdate string `json:"birthdate,omitempty"`

	// Created By User ID
	Createdbyid string `json:"createdbyid,omitempty"`

	// Created Date
	Createddate string `json:"createddate,omitempty"`

	// Department
	Department string `json:"department,omitempty"`

	// Description
	Description string `json:"description,omitempty"`

	// Do Not Call?
	Donotcall bool `json:"donotcall,omitempty"`

	// Email address
	Email string `json:"email,omitempty"`

	// Email Bounce Date
	Emailbounceddate string `json:"emailbounceddate,omitempty"`

	// Email Bounce Reason
	Emailbouncedreason string `json:"emailbouncedreason,omitempty"`

	// Taxnexus Enrollment Status
	Enrollmentstatus string `json:"enrollmentstatus,omitempty"`

	// Fax Number
	Fax string `json:"fax,omitempty"`

	// First Name
	Firstname string `json:"firstname,omitempty"`

	// Email Opt Out
	Hasoptedoutofemail bool `json:"hasoptedoutofemail,omitempty"`

	// Fax Opt Out
	Hasoptedoutoffax bool `json:"hasoptedoutoffax,omitempty"`

	// Home Phone
	Homephone string `json:"homephone,omitempty"`

	// Taxnexus Record Id
	ID string `json:"id,omitempty"`

	// Does this contact have bounced emails?
	Isemailbounced bool `json:"isemailbounced,omitempty"`

	// Is Provisioned?
	Isprovisioned bool `json:"isprovisioned,omitempty"`

	// Last Modified By User ID
	Lastmodifiedbyid string `json:"lastmodifiedbyid,omitempty"`

	// Last Modified Date
	Lastmodifieddate string `json:"lastmodifieddate,omitempty"`

	// Last Name
	Lastname string `json:"lastname,omitempty"`

	// Lead Source
	Leadsource string `json:"leadsource,omitempty"`

	// Level
	Level string `json:"level,omitempty"`

	// LinkedIn Page
	Linkedin string `json:"linkedin,omitempty"`

	// mailingaddress
	Mailingaddress *Address `json:"mailingaddress,omitempty"`

	// Mailing Lists
	Mailinglists string `json:"mailinglists,omitempty"`

	// Mobile Phone
	Mobilephone string `json:"mobilephone,omitempty"`

	// Full Name
	Name string `json:"name,omitempty"`

	// otheraddress
	Otheraddress *Address `json:"otheraddress,omitempty"`

	// Other Phone
	Otherphone string `json:"otherphone,omitempty"`

	// The User ID of the user who owns this Contact
	Ownerid string `json:"ownerid,omitempty"`

	// Personal Email Address for this Contact
	Personalemail string `json:"personalemail,omitempty"`

	// Phone Number
	Phone string `json:"phone,omitempty"`

	// URL of a photograph of this User
	Photourl string `json:"photourl,omitempty"`

	// Recruiting Status
	Recruitingstatus string `json:"recruitingstatus,omitempty"`

	// External reference to this contact, if any
	Ref string `json:"ref,omitempty"`

	// Reports To Contact ID
	Reportstoid string `json:"reportstoid,omitempty"`

	// Contact Salutation
	Salutation string `json:"salutation,omitempty"`

	// The Contact Status
	Status string `json:"status,omitempty"`

	// tenant identifier
	Tenantid string `json:"tenantid,omitempty"`

	// Contact Title
	Title string `json:"title,omitempty"`

	// Contact Type
	Type string `json:"type,omitempty"`
}

// Validate validates this contact
func (m *Contact) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateMailingaddress(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateOtheraddress(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *Contact) validateMailingaddress(formats strfmt.Registry) error {

	if swag.IsZero(m.Mailingaddress) { // not required
		return nil
	}

	if m.Mailingaddress != nil {
		if err := m.Mailingaddress.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("mailingaddress")
			}
			return err
		}
	}

	return nil
}

func (m *Contact) validateOtheraddress(formats strfmt.Registry) error {

	if swag.IsZero(m.Otheraddress) { // not required
		return nil
	}

	if m.Otheraddress != nil {
		if err := m.Otheraddress.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("otheraddress")
			}
			return err
		}
	}

	return nil
}

// MarshalBinary interface implementation
func (m *Contact) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *Contact) UnmarshalBinary(b []byte) error {
	var res Contact
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
