lib/api/ops/ops_models/quote.go

614 lines
14 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package ops_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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Quote quote
//
// swagger:model Quote
type Quote struct {
// Account ID
AccountID string `json:"AccountID,omitempty"`
// additional address
AdditionalAddress *Address `json:"AdditionalAddress,omitempty"`
// Additional To Name
AdditionalName string `json:"AdditionalName,omitempty"`
// The Quote Amount
Amount float64 `json:"Amount,omitempty"`
// billing address
BillingAddress *Address `json:"BillingAddress,omitempty"`
// Billing Contact ID
BillingContactID string `json:"BillingContactID,omitempty"`
// Bill To Name
BillingName string `json:"BillingName,omitempty"`
// business address
BusinessAddress *Address `json:"BusinessAddress,omitempty"`
// Business Tax Amount
BusinessTax float64 `json:"BusinessTax,omitempty"`
// Cannabis Tax
CannabisTax float64 `json:"CannabisTax,omitempty"`
// Contact ID
ContactID string `json:"ContactID,omitempty"`
// Contract ID
ContractID string `json:"ContractID,omitempty"`
// Contact ID
CoordinateID string `json:"CoordinateID,omitempty"`
// Created By User ID
CreatedByID string `json:"CreatedByID,omitempty"`
// Created Date
CreatedDate string `json:"CreatedDate,omitempty"`
// Credit Terms
CreditTerms string `json:"CreditTerms,omitempty"`
// OEM Customer Identifier
CustomerID string `json:"CustomerID,omitempty"`
// Description
Description string `json:"Description,omitempty"`
// Discount Percentage
Discount float64 `json:"Discount,omitempty"`
// Discount Amount
DiscountAmount float64 `json:"DiscountAmount,omitempty"`
// Email
Email string `json:"Email,omitempty"`
// End User Contact ID
EndUserID string `json:"EndUserID,omitempty"`
// Invoice Total from source system
EstimatedAmount float64 `json:"EstimatedAmount,omitempty"`
// Business tax from source system
EstimatedBusinessTax float64 `json:"EstimatedBusinessTax,omitempty"`
// Cost of Goods Sold from source system
EstimatedCOGS float64 `json:"EstimatedCOGS,omitempty"`
// Cannabis Tax from source system
EstimatedCannabisTax float64 `json:"EstimatedCannabisTax,omitempty"`
// Cannabis Tax from source system
EstimatedDiscount float64 `json:"EstimatedDiscount,omitempty"`
// Sales Tax from source system
EstimatedSalesTax float64 `json:"EstimatedSalesTax,omitempty"`
// Invoice Subtotal from source system
EstimatedSubtotal float64 `json:"EstimatedSubtotal,omitempty"`
// Expiration Date
ExpirationDate string `json:"ExpirationDate,omitempty"`
// Fax
Fax string `json:"Fax,omitempty"`
// Grand Total
GrandTotal float64 `json:"GrandTotal,omitempty"`
// Taxnexus Record Id
ID string `json:"ID,omitempty"`
// ID of the Ingest which created this Invoice
IngestID string `json:"IngestID,omitempty"`
// Installation Date
InstallationDate string `json:"InstallationDate,omitempty"`
// items
Items []*QuoteItem `json:"Items"`
// ID of the Job which created this Invoice
JobID string `json:"JobID,omitempty"`
// Last Modified By User ID
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// Last Modified Date
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// Monthly Amount quoted
MonthlyAmount float64 `json:"MonthlyAmount,omitempty"`
// Quote Name
Name string `json:"Name,omitempty"`
// Opportunity Name
OpportunityID string `json:"OpportunityID,omitempty"`
// Owner Name
OwnerID string `json:"OwnerID,omitempty"`
// Reference the master record that owns this item
ParentFK string `json:"ParentFK,omitempty"`
// Payment Terms
PaymentTerms string `json:"PaymentTerms,omitempty"`
// Period ID
PeriodID string `json:"PeriodID,omitempty"`
// Phone
Phone string `json:"Phone,omitempty"`
// Place GeoCode
PlaceGeoCode string `json:"PlaceGeoCode,omitempty"`
// Purchase Amount
PurchaseAmount float64 `json:"PurchaseAmount,omitempty"`
// Quote Amount
QuoteAmount float64 `json:"QuoteAmount,omitempty"`
// Quote Date
QuoteDate string `json:"QuoteDate,omitempty"`
// Quote Number
QuoteNumber string `json:"QuoteNumber,omitempty"`
// quote to address
QuoteToAddress *Address `json:"QuoteToAddress,omitempty"`
// Quote To Name
QuoteToName string `json:"QuoteToName,omitempty"`
// Source System identifier for this record, if any
Ref string `json:"Ref,omitempty"`
// Sales Regulation Type
SalesRegulation string `json:"SalesRegulation,omitempty"`
// Sales Tax Amount
SalesTax float64 `json:"SalesTax,omitempty"`
// Service Term
ServiceTerm string `json:"ServiceTerm,omitempty"`
// shipping address
ShippingAddress *Address `json:"ShippingAddress,omitempty"`
// Shipping Contact ID
ShippingContactID string `json:"ShippingContactID,omitempty"`
// Shipping and Handling
ShippingHandling float64 `json:"ShippingHandling,omitempty"`
// Ship To Name
ShippingName string `json:"ShippingName,omitempty"`
// Status
Status string `json:"Status,omitempty"`
// Subtotal
Subtotal float64 `json:"Subtotal,omitempty"`
// Tax
Tax float64 `json:"Tax,omitempty"`
// The taxes associated with this Quote
TaxTransactions []*TaxTransaction `json:"TaxTransactions"`
// Telecom Tax
TelecomTax float64 `json:"TelecomTax,omitempty"`
// Template
TemplateID string `json:"TemplateID,omitempty"`
// ID of the Tenant that owns this object
TenantID string `json:"TenantID,omitempty"`
// total
Total *Total `json:"Total,omitempty"`
// Total Price
TotalPrice float64 `json:"TotalPrice,omitempty"`
// Quote Type
Type string `json:"Type,omitempty"`
}
// Validate validates this quote
func (m *Quote) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAdditionalAddress(formats); err != nil {
res = append(res, err)
}
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.validateItems(formats); err != nil {
res = append(res, err)
}
if err := m.validateQuoteToAddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateShippingAddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateTaxTransactions(formats); err != nil {
res = append(res, err)
}
if err := m.validateTotal(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Quote) validateAdditionalAddress(formats strfmt.Registry) error {
if swag.IsZero(m.AdditionalAddress) { // not required
return nil
}
if m.AdditionalAddress != nil {
if err := m.AdditionalAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("AdditionalAddress")
}
return err
}
}
return nil
}
func (m *Quote) 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 *Quote) 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 *Quote) validateItems(formats strfmt.Registry) error {
if swag.IsZero(m.Items) { // not required
return nil
}
for i := 0; i < len(m.Items); i++ {
if swag.IsZero(m.Items[i]) { // not required
continue
}
if m.Items[i] != nil {
if err := m.Items[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Items" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Quote) validateQuoteToAddress(formats strfmt.Registry) error {
if swag.IsZero(m.QuoteToAddress) { // not required
return nil
}
if m.QuoteToAddress != nil {
if err := m.QuoteToAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("QuoteToAddress")
}
return err
}
}
return nil
}
func (m *Quote) 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
}
func (m *Quote) validateTaxTransactions(formats strfmt.Registry) error {
if swag.IsZero(m.TaxTransactions) { // not required
return nil
}
for i := 0; i < len(m.TaxTransactions); i++ {
if swag.IsZero(m.TaxTransactions[i]) { // not required
continue
}
if m.TaxTransactions[i] != nil {
if err := m.TaxTransactions[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("TaxTransactions" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Quote) validateTotal(formats strfmt.Registry) error {
if swag.IsZero(m.Total) { // not required
return nil
}
if m.Total != nil {
if err := m.Total.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Total")
}
return err
}
}
return nil
}
// ContextValidate validate this quote based on the context it is used
func (m *Quote) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateAdditionalAddress(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateBillingAddress(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateBusinessAddress(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateItems(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateQuoteToAddress(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateShippingAddress(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateTaxTransactions(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateTotal(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Quote) contextValidateAdditionalAddress(ctx context.Context, formats strfmt.Registry) error {
if m.AdditionalAddress != nil {
if err := m.AdditionalAddress.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("AdditionalAddress")
}
return err
}
}
return nil
}
func (m *Quote) 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 *Quote) contextValidateBusinessAddress(ctx context.Context, formats strfmt.Registry) error {
if m.BusinessAddress != nil {
if err := m.BusinessAddress.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BusinessAddress")
}
return err
}
}
return nil
}
func (m *Quote) contextValidateItems(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Items); i++ {
if m.Items[i] != nil {
if err := m.Items[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Items" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Quote) contextValidateQuoteToAddress(ctx context.Context, formats strfmt.Registry) error {
if m.QuoteToAddress != nil {
if err := m.QuoteToAddress.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("QuoteToAddress")
}
return err
}
}
return nil
}
func (m *Quote) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.ShippingAddress != nil {
if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ShippingAddress")
}
return err
}
}
return nil
}
func (m *Quote) contextValidateTaxTransactions(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.TaxTransactions); i++ {
if m.TaxTransactions[i] != nil {
if err := m.TaxTransactions[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("TaxTransactions" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Quote) contextValidateTotal(ctx context.Context, formats strfmt.Registry) error {
if m.Total != nil {
if err := m.Total.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Total")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Quote) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Quote) UnmarshalBinary(b []byte) error {
var res Quote
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}