lib/api/crm/crm_models/company.go

249 lines
5.9 KiB
Go
Raw Normal View History

2021-07-31 03:05:02 +00:00
// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Telnexus LLC
// 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 (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Company company
//
// swagger:model Company
type Company struct {
// Telnexus ID of the Account that owns this Company
AccountID string `json:"AccountID,omitempty"`
// Account Number Prefix
AccountNumberPrefix string `json:"AccountNumberPrefix,omitempty"`
// billing address
BillingAddress *Address `json:"BillingAddress,omitempty"`
// Billing Advice
BillingAdvice string `json:"BillingAdvice,omitempty"`
// Contact ID
BillingContactID string `json:"BillingContactID,omitempty"`
// Billing Email
BillingEmail string `json:"BillingEmail,omitempty"`
// Billing Phone
BillingPhone string `json:"BillingPhone,omitempty"`
// Billing Website
BillingWebsite string `json:"BillingWebsite,omitempty"`
// Chart of Accounts Template Account ID
COATemplateID string `json:"COATemplateID,omitempty"`
// Color Accent1
ColorAccent1 string `json:"ColorAccent1,omitempty"`
// Color Accent2
ColorAccent2 string `json:"ColorAccent2,omitempty"`
// Color Primary
ColorPrimary string `json:"ColorPrimary,omitempty"`
// Created By User ID
CreatedByID string `json:"CreatedByID,omitempty"`
// Created Date
CreatedDate string `json:"CreatedDate,omitempty"`
// User ID of default Customer Success user
CustomerSuccessID string `json:"CustomerSuccessID,omitempty"`
// Date Closed
DateClosed string `json:"DateClosed,omitempty"`
// default address
DefaultAddress *Address `json:"DefaultAddress,omitempty"`
// Default Company?
DefaultCompany bool `json:"DefaultCompany,omitempty"`
// Font Name for Body Text
FontBody string `json:"FontBody,omitempty"`
// Font Name for Heading
FontHeading string `json:"FontHeading,omitempty"`
// Font Name for Heading Narrow
FontHeadingNarrow string `json:"FontHeadingNarrow,omitempty"`
// Font Names for CSS Link
FontLink string `json:"FontLink,omitempty"`
// Font Name for Monospace
FontMono string `json:"FontMono,omitempty"`
// Telnexus Record Id
ID string `json:"ID,omitempty"`
// International Customers?
International bool `json:"International,omitempty"`
// Last Account Number
LastAccountNumber int64 `json:"LastAccountNumber,omitempty"`
// Last Modified By User ID
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// Last Modified Date
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// Last TaxType Number
LastTaxTypeNumber int64 `json:"LastTaxTypeNumber,omitempty"`
// Logo URL
Logo string `json:"Logo,omitempty"`
// Company Name
Name string `json:"Name,omitempty"`
// The ID of the contact who owns this Company
OwnerID string `json:"OwnerID,omitempty"`
// User ID of the default tax preparer
PreparerID string `json:"PreparerID,omitempty"`
// The ID of the default Pricebook for this company
PricebookID string `json:"PricebookID,omitempty"`
// Tenant Identifier
TenantID string `json:"TenantID,omitempty"`
// The ID of the contact who is the User Tech Lead for Company
UserTechLeadID string `json:"UserTechLeadID,omitempty"`
}
// Validate validates this company
func (m *Company) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBillingAddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateDefaultAddress(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Company) 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 *Company) 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
}
// ContextValidate validate this company based on the context it is used
func (m *Company) 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.contextValidateDefaultAddress(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Company) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.BillingAddress != nil {
if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BillingAddress")
}
return err
}
}
return nil
}
func (m *Company) contextValidateDefaultAddress(ctx context.Context, formats strfmt.Registry) error {
if m.DefaultAddress != nil {
if err := m.DefaultAddress.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("DefaultAddress")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Company) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Company) UnmarshalBinary(b []byte) error {
var res Company
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}