// 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 crm_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"
)

// Lead lead
//
// swagger:model Lead
type Lead struct {

	// address
	Address *Address `json:"Address,omitempty"`

	// Company
	Company string `json:"Company,omitempty"`

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

	// Created Date
	CreatedDate string `json:"CreatedDate,omitempty"`

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

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

	// First Name
	FirstName string `json:"FirstName,omitempty"`

	// Taxnexus Record Id
	ID string `json:"ID,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"`

	// Mobile
	MobilePhone string `json:"MobilePhone,omitempty"`

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

	// LeadBasic Owner
	OwnerID string `json:"OwnerId,omitempty"`

	// Partner Account
	PartnerAccountID string `json:"PartnerAccountId,omitempty"`

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

	// Product
	ProductID string `json:"ProductID,omitempty"`

	// referer_url
	RefererURL string `json:"RefererURL,omitempty"`

	// LeadBasic Status
	Status string `json:"Status,omitempty"`

	// Tenant Identifier
	TenantID string `json:"TenantID,omitempty"`

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

	// Type
	Type string `json:"Type,omitempty"`

	// utm_campaign
	UTMCampaign string `json:"UTMCampaign,omitempty"`

	// utm_content
	UTMContent string `json:"UTMContent,omitempty"`

	// utm_medium
	UTMMedium string `json:"UTMMedium,omitempty"`

	// utm_source
	UTMSource string `json:"UTMSource,omitempty"`

	// utm_term
	UTMTerm string `json:"UTMTerm,omitempty"`

	// Website
	Website string `json:"Website,omitempty"`
}

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

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

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

func (m *Lead) validateAddress(formats strfmt.Registry) error {

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

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

	return nil
}

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

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