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

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

package sfgate_models

import (
	"context"
	stderrors "errors"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag/jsonutils"
	"github.com/go-openapi/swag/typeutils"
)

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

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

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

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

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

	// AppExchange URL
	AppExchange *string `json:"AppExchange,omitempty"`

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

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

	// Marketing Channels (Multiselect Picklist)
	Channels *string `json:"Channels,omitempty"`

	// Closed Date
	ClosedDate *string `json:"ClosedDate,omitempty"`

	// cloud revenue total
	CloudRevenueTotal *float64 `json:"CloudRevenueTotal,omitempty"`

	// The type of cloud company
	CloudType *string `json:"CloudType,omitempty"`

	// The year company started cloud revenue
	CloudYear *string `json:"CloudYear,omitempty"`

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

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

	// Crunchbase URL
	CrunchbaseURL *string `json:"CrunchbaseURL,omitempty"`

	// Description of the account
	Description *string `json:"Description,omitempty"`

	// e i n
	EIN *string `json:"EIN,omitempty"`

	// Earnings Call Date
	EarningsCall *string `json:"EarningsCall,omitempty"`

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

	// Enrichment Status
	EnrichmentStatus *string `json:"EnrichmentStatus,omitempty"`

	// The amount of equity EquityFunding
	EquityFunding *float64 `json:"EquityFunding,omitempty"`

	// Company Facebook URL
	Facebook *string `json:"Facebook,omitempty"`

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

	// Date company founded
	FoundedDate *string `json:"FoundedDate,omitempty"`

	// Full Description
	FullDescription *string `json:"FullDescription,omitempty"`

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

	// IPO Date
	IPODate *string `json:"IPODate,omitempty"`

	// image alt text
	ImageAltText *string `json:"ImageAltText,omitempty"`

	// image URL
	ImageURL *string `json:"ImageURL,omitempty"`

	// Industries
	Industries *string `json:"Industries,omitempty"`

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

	// Last Enriched By User ID
	LastEnrichedByID *string `json:"LastEnrichedByID,omitempty"`

	// Last Enriched Date
	LastEnrichmentDate *string `json:"LastEnrichmentDate,omitempty"`

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

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

	// Company LinkedIn URL
	LinkedIn *string `json:"LinkedIn,omitempty"`

	// Headquarters Location Description
	Location *string `json:"Location,omitempty"`

	// Company Logo URL
	Logo *string `json:"Logo,omitempty"`

	// Market Capitalization
	MarketCapitalization *float64 `json:"MarketCapitalization,omitempty"`

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

	// Number of Investments
	NumberInvestments *float64 `json:"NumberInvestments,omitempty"`

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

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

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

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

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

	// Publish this record?
	Publish *bool `json:"Publish,omitempty"`

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

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

	// A Salesforce-First company?
	SalesforceFirst *bool `json:"SalesforceFirst,omitempty"`

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

	// Shipping Contact ID
	ShippingContactID *string `json:"ShippingContactID,omitempty"`

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

	// Slug
	Slug *string `json:"Slug,omitempty"`

	// Company tagline
	TagLine *string `json:"TagLine,omitempty"`

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

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

	// Twitter URL
	Twitter *string `json:"Twitter,omitempty"`

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

	// Website
	Website *string `json:"Website,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.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 typeutils.IsZero(m.BillingAddress) { // not required
		return nil
	}

	if m.BillingAddress != nil {
		if err := m.BillingAddress.Validate(formats); err != nil {
			ve := new(errors.Validation)
			if stderrors.As(err, &ve) {
				return ve.ValidateName("BillingAddress")
			}
			ce := new(errors.CompositeError)
			if stderrors.As(err, &ce) {
				return ce.ValidateName("BillingAddress")
			}

			return err
		}
	}

	return nil
}

func (m *Account) validateShippingAddress(formats strfmt.Registry) error {
	if typeutils.IsZero(m.ShippingAddress) { // not required
		return nil
	}

	if m.ShippingAddress != nil {
		if err := m.ShippingAddress.Validate(formats); err != nil {
			ve := new(errors.Validation)
			if stderrors.As(err, &ve) {
				return ve.ValidateName("ShippingAddress")
			}
			ce := new(errors.CompositeError)
			if stderrors.As(err, &ce) {
				return ce.ValidateName("ShippingAddress")
			}

			return err
		}
	}

	return nil
}

// ContextValidate validate this account based on the context it is used
func (m *Account) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

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

func (m *Account) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error {

	if m.BillingAddress != nil {

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

		if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil {
			ve := new(errors.Validation)
			if stderrors.As(err, &ve) {
				return ve.ValidateName("BillingAddress")
			}
			ce := new(errors.CompositeError)
			if stderrors.As(err, &ce) {
				return ce.ValidateName("BillingAddress")
			}

			return err
		}
	}

	return nil
}

func (m *Account) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error {

	if m.ShippingAddress != nil {

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

		if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil {
			ve := new(errors.Validation)
			if stderrors.As(err, &ve) {
				return ve.ValidateName("ShippingAddress")
			}
			ce := new(errors.CompositeError)
			if stderrors.As(err, &ce) {
				return ce.ValidateName("ShippingAddress")
			}

			return err
		}
	}

	return nil
}

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

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