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

// Account account
//
// swagger:model Account
type Account struct {

	// Account Number
	AccountNumber string `json:"AccountNumber,omitempty"`

	// The marketing orgin of this account
	AccountSource string `json:"AccountSource,omitempty"`

	// Active
	Active bool `json:"Active,omitempty"`

	// For tax authorities, this account's administrative level, e.g. Local, County, State or Federal
	AdministrativeLevel string `json:"AdministrativeLevel,omitempty"`

	// Rollup Tax Amount
	Amount float64 `json:"Amount,omitempty"`

	// Amount Invoiced
	AmountInvoiced float64 `json:"AmountInvoiced,omitempty"`

	// Amount Paid
	AmountPaid float64 `json:"AmountPaid,omitempty"`

	// Annual Revenue Estimate
	AnnualRevenue float64 `json:"AnnualRevenue,omitempty"`

	// Account Balance
	Balance float64 `json:"Balance,omitempty"`

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

	// Contact ID
	BillingContactID string `json:"BillingContactID,omitempty"`

	// Billing Preference
	BillingPreference string `json:"BillingPreference,omitempty"`

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

	// Is this a cannabis customer?
	CannabisCustomer bool `json:"CannabisCustomer,omitempty"`

	// Channel Program Level Name
	ChannelProgramLevelName string `json:"ChannelProgramLevelName,omitempty"`

	// Channel Program Name
	ChannelProgramName string `json:"ChannelProgramName,omitempty"`

	// Client End Date
	ClientEndDate string `json:"ClientEndDate,omitempty"`

	// Client Start Date
	ClientStartDate string `json:"ClientStartDate,omitempty"`

	// The Company ID of this Account
	CompanyID string `json:"CompanyID,omitempty"`

	// The Id of the geo coordinates of this account
	CoordinateID string `json:"CoordinateID,omitempty"`

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

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

	// Customer ID from source system
	CustomerID string `json:"CustomerID,omitempty"`

	// Customer Priority
	CustomerPriority string `json:"CustomerPriority,omitempty"`

	// This Account's 'Doing Business As' name
	DBA string `json:"DBA,omitempty"`

	// D-U-N-S Number
	DUNSNumber string `json:"DUNSNumber,omitempty"`

	// D-n-B Company
	DandBCompanyID string `json:"DandBCompanyID,omitempty"`

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

	// Default Backend ID
	DefaultBackendID string `json:"DefaultBackendID,omitempty"`

	// Default Delivery Address Contact ID
	DefaultDeliveryContactID string `json:"DefaultDeliveryContactID,omitempty"`

	// Default End User Contact ID
	DefaultEndUserID string `json:"DefaultEndUserID,omitempty"`

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

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

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

	// Enrollment Status
	EnrollmentStatus string `json:"EnrollmentStatus,omitempty"`

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

	// Taxnexus Account Id
	ID string `json:"ID,omitempty"`

	// ISP Customer?
	ISPCustomer bool `json:"ISPCustomer,omitempty"`

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

	// Customer Portal Account
	IsCustomerPortal bool `json:"IsCustomerPortal,omitempty"`

	// Partner Account
	IsPartner bool `json:"IsPartner,omitempty"`

	// Data.com Key
	JigSaw string `json:"JigSaw,omitempty"`

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

	// Last Modified Date
	LastModifiedDate string `json:"LastModifiedDate,omitempty"`

	// MSP Customer?
	MSPCustomer bool `json:"MSPCustomer,omitempty"`

	// NAICS Code
	NAICSCode string `json:"NAICSCode,omitempty"`

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

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

	// Employee Count Estimate
	NumberOfEmployees int64 `json:"NumberOfEmployees,omitempty"`

	// Number of Locations Estimate
	NumberOfLocations int64 `json:"NumberOfLocations,omitempty"`

	// Open Charges
	OpenCharges float64 `json:"OpenCharges,omitempty"`

	// Vendor Order Contact ID
	OrderContactID string `json:"OrderContactID,omitempty"`

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

	// Account Owner User ID
	OwnerID string `json:"OwnerID,omitempty"`

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

	// Parent Foreign Key
	ParentFK string `json:"ParentFK,omitempty"`

	// Parent Account
	ParentID string `json:"ParentID,omitempty"`

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

	// The ID of the Place situs record that applies to this Account
	PlaceID string `json:"PlaceID,omitempty"`

	// Tax Preparer Contact ID
	PreparerID string `json:"PreparerID,omitempty"`

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

	// Rating Engine identifier
	RatingEngineID string `json:"RatingEngineID,omitempty"`

	// External Reference ID
	Ref string `json:"Ref,omitempty"`

	// Rollup Revenue Base
	RevenueBase float64 `json:"RevenueBase,omitempty"`

	// Rollup Revenue Net
	RevenueNet float64 `json:"RevenueNet,omitempty"`

	// Rollup Revenue Not Taxable
	RevenueNotTaxable float64 `json:"RevenueNotTaxable,omitempty"`

	// SIC Code
	SIC string `json:"SIC,omitempty"`

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

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

	// Shipping Census Tract
	ShippingCensusTract string `json:"ShippingCensusTract,omitempty"`

	// Shipping Contact ID
	ShippingConactID string `json:"ShippingConactID,omitempty"`

	// Shipping County
	ShippingCounty string `json:"ShippingCounty,omitempty"`

	// Account Site
	Site string `json:"Site,omitempty"`

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

	// Tax Exemption
	TaxExemption string `json:"TaxExemption,omitempty"`

	// Rollup Tax On Tax
	TaxOnTax float64 `json:"TaxOnTax,omitempty"`

	// Telecom Customer?
	TelecomCustomer bool `json:"TelecomCustomer,omitempty"`

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

	// Ticker Symbol
	TickerSymbol string `json:"TickerSymbol,omitempty"`

	// Tradestyle
	TradeStyle string `json:"TradeStyle,omitempty"`

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

	// Unapplied Payments
	UnappliedPayments float64 `json:"UnappliedPayments,omitempty"`

	// Rollup Unit Base
	UnitBase float64 `json:"UnitBase,omitempty"`

	// Upsell Opportunity
	UpsellOpportunity string `json:"UpsellOpportunity,omitempty"`

	// WHMCS Client ID
	WHMCSClientID int64 `json:"WHMCSClientID,omitempty"`

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

	// Xero Contact ID
	XeroContactID string `json:"XeroContactID,omitempty"`

	// Year Started
	YearStarted string `json:"YearStarted,omitempty"`
}

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

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

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

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

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

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

func (m *Account) validateBillingAddress(formats strfmt.Registry) error {

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

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

	return nil
}

func (m *Account) validateBusinessAddress(formats strfmt.Registry) error {

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

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

	return nil
}

func (m *Account) validateDefaultAddress(formats strfmt.Registry) error {

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

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

	return nil
}

func (m *Account) validateShippingAddress(formats strfmt.Registry) error {

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

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

	return nil
}

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

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