lib/api/ops/ops_models/quote_basic.go

326 lines
7.8 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"
)
// QuoteBasic quote basic
//
// swagger:model QuoteBasic
type QuoteBasic struct {
// Account Identifier from Source System; ignored in tax calculations
AccountID string `json:"AccountID,omitempty"`
// Invoice Amount
Amount float64 `json:"Amount,omitempty"`
// business address
BusinessAddress *Address `json:"BusinessAddress,omitempty"`
// OEM Customer Identifier
CustomerID string `json:"CustomerID,omitempty"`
// Invoice Total from source system
EstimatedAmount float64 `json:"EstimatedAmount,omitempty"`
// Business tax from source system
EstimatedBusinessTax float64 `json:"EstimatedBusinessTax,omitempty"`
// Cannabis Tax from source system
EstimatedCannabisTax float64 `json:"EstimatedCannabisTax,omitempty"`
// Cost of Goods Sold from source system
EstimatedCogs float64 `json:"EstimatedCogs,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"`
// Taxnexus ID
ID string `json:"ID,omitempty"`
// ID of the Ingest which created this Invoice
IngestID string `json:"IngestID,omitempty"`
// The items associated with this Invoice
Items []*ItemBasic `json:"Items"`
// ID of the Job which created this Invoice
JobID string `json:"JobID,omitempty"`
// Reference the master record that owns this item
ParentFK string `json:"ParentFK,omitempty"`
// Taxnexus Period ID
PeriodID string `json:"PeriodID,omitempty"`
// Invoice Date; should be date only or correct time zone if in time notation
QuoteDate string `json:"QuoteDate,omitempty"`
// Source System Customer-Facing Invoice Number; ignored in tax calculation
QuoteNumber string `json:"QuoteNumber,omitempty"`
// Source System identifier for this record, if any
Ref string `json:"Ref,omitempty"`
// Sales Regulation Type
SalesRegulation string `json:"SalesRegulation,omitempty"`
// Shipping and Handling fees for this document
ShippingHandling float64 `json:"ShippingHandling,omitempty"`
// Status used by for Billing Balances; ignored in tax calculation
Status string `json:"Status,omitempty"`
// Subtotal of items
Subtotal float64 `json:"Subtotal,omitempty"`
// The Tax Transactions "Source System identifier for this record, if any; copied to quoteitemid in Tax Transaction result records"
TaxTransactions []*TaxTransaction `json:"TaxTransactions"`
// ID of the Tenant that owns this object
TenantID string `json:"TenantID,omitempty"`
// total
Total *Total `json:"Total,omitempty"`
// Invoice Type
Type string `json:"Type,omitempty"`
}
// Validate validates this quote basic
func (m *QuoteBasic) Validate(formats strfmt.Registry) error {
var res []error
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.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 *QuoteBasic) 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 *QuoteBasic) 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 *QuoteBasic) 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 *QuoteBasic) 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 basic based on the context it is used
func (m *QuoteBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
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.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 *QuoteBasic) 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 *QuoteBasic) 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 *QuoteBasic) 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 *QuoteBasic) 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 *QuoteBasic) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *QuoteBasic) UnmarshalBinary(b []byte) error {
var res QuoteBasic
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}