lib/api/sf-gate/sf_gate_models/order.go

509 lines
11 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 sf_gate_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"
)
// Order order
//
// swagger:model Order
type Order struct {
// accountid
Accountid string `json:"accountid,omitempty"`
// Account Number
Accountnumber string `json:"accountnumber,omitempty"`
// Activated By
Activatedbyid string `json:"activatedbyid,omitempty"`
// Activated Date
Activateddate string `json:"activateddate,omitempty"`
// Order Amount
Amount float64 `json:"amount,omitempty"`
// billingaddress
Billingaddress *Address `json:"billingaddress,omitempty"`
// billingcontactid
Billingcontactid string `json:"billingcontactid,omitempty"`
// Billing Type
Billingtype string `json:"billingtype,omitempty"`
// Bill To Contact
Billtocontactid string `json:"billtocontactid,omitempty"`
// Cannabis Tax
Cannabistax float64 `json:"cannabistax,omitempty"`
// Company Authorized By
Companyauthorizedbyid string `json:"companyauthorizedbyid,omitempty"`
// Company Authorized Date
Companyauthorizeddate string `json:"companyauthorizeddate,omitempty"`
// Completion Status
Completion string `json:"completion,omitempty"`
// contract
Contract *ContractBasic `json:"contract,omitempty"`
// Contract End Date
Contractenddate string `json:"contractenddate,omitempty"`
// Contract Number
Contractid string `json:"contractid,omitempty"`
// Contract Name
Contractname string `json:"contractname,omitempty"`
// coordinate
Coordinate *Address `json:"coordinate,omitempty"`
// Customer Authorized By
Customerauthorizedbyid string `json:"customerauthorizedbyid,omitempty"`
// Customer Authorized Date
Customerauthorizeddate string `json:"customerauthorizeddate,omitempty"`
// Description
Description string `json:"description,omitempty"`
// Order Start Date
Effectivedate string `json:"effectivedate,omitempty"`
// Order End Date
Enddate string `json:"enddate,omitempty"`
// enduserid
Enduserid string `json:"enduserid,omitempty"`
// Taxnexus Record Id Only; not used in POST
ID string `json:"id,omitempty"`
// Installation Date
Installationdate string `json:"installationdate,omitempty"`
// Invoice
Invoice string `json:"invoice,omitempty"`
// Reduction Order
Isreductionorder bool `json:"isreductionorder,omitempty"`
// The Order Items
Items []*OrderItem `json:"items"`
// Line Item Count
Lineitemcount int64 `json:"lineitemcount,omitempty"`
// Monthly Amount
Monthlyamount float64 `json:"monthlyamount,omitempty"`
// Order Name
Name string `json:"name,omitempty"`
// Open Order?
Open bool `json:"open,omitempty"`
// Opportunity
Opportunityid string `json:"opportunityid,omitempty"`
// Order Number
Ordernumber string `json:"ordernumber,omitempty"`
// Order Reference Number
Orderreferencenumber string `json:"orderreferencenumber,omitempty"`
// Original Order
Originalorderid string `json:"originalorderid,omitempty"`
// Order Owner
Ownerid string `json:"ownerid,omitempty"`
// UUID Reference the master record that owns this item
Parentfk string `json:"parentfk,omitempty"`
// Payment Method
Paymentmethodid string `json:"paymentmethodid,omitempty"`
// Payment Terms
Paymentterms string `json:"paymentterms,omitempty"`
// PO Date
Podate string `json:"podate,omitempty"`
// PO Number
Ponumber string `json:"ponumber,omitempty"`
// Provisioning Status
Provisioningstatus string `json:"provisioningstatus,omitempty"`
// Purchase Amount
Purchaseamount float64 `json:"purchaseamount,omitempty"`
// Quote
Quoteid string `json:"quoteid,omitempty"`
// Order Record Type
Recordtypeid string `json:"recordtypeid,omitempty"`
// Source System identifier for this record, if any
Ref string `json:"ref,omitempty"`
// Sales Regulation Type
Salesregulation string `json:"salesregulation,omitempty"`
// Sales Tax
Salestax float64 `json:"salestax,omitempty"`
// Service Term
Serviceterm string `json:"serviceterm,omitempty"`
// shippingaddress
Shippingaddress *Address `json:"shippingaddress,omitempty"`
// shippingcontactid
Shippingcontactid string `json:"shippingcontactid,omitempty"`
// Shipping & Handling
Shippinghandling float64 `json:"shippinghandling,omitempty"`
// Ship To Contact
Shiptocontactid string `json:"shiptocontactid,omitempty"`
// Status
Status string `json:"status,omitempty"`
// Subtotal
Subtotal float64 `json:"subtotal,omitempty"`
// The taxes associated with this Order
Taxitems []*TaxTransaction `json:"taxitems"`
// Telecom Tax
Telecomtax float64 `json:"telecomtax,omitempty"`
// Template
Templateid string `json:"templateid,omitempty"`
// tenant identifier
Tenantid string `json:"tenantid,omitempty"`
// Order Amount
Totalamount int64 `json:"totalamount,omitempty"`
// Order Type
Type string `json:"type,omitempty"`
}
// Validate validates this order
func (m *Order) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBillingaddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateContract(formats); err != nil {
res = append(res, err)
}
if err := m.validateCoordinate(formats); err != nil {
res = append(res, err)
}
if err := m.validateItems(formats); err != nil {
res = append(res, err)
}
if err := m.validateShippingaddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateTaxitems(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Order) 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 *Order) validateContract(formats strfmt.Registry) error {
if swag.IsZero(m.Contract) { // not required
return nil
}
if m.Contract != nil {
if err := m.Contract.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("contract")
}
return err
}
}
return nil
}
func (m *Order) validateCoordinate(formats strfmt.Registry) error {
if swag.IsZero(m.Coordinate) { // not required
return nil
}
if m.Coordinate != nil {
if err := m.Coordinate.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("coordinate")
}
return err
}
}
return nil
}
func (m *Order) 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 *Order) 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 *Order) validateTaxitems(formats strfmt.Registry) error {
if swag.IsZero(m.Taxitems) { // not required
return nil
}
for i := 0; i < len(m.Taxitems); i++ {
if swag.IsZero(m.Taxitems[i]) { // not required
continue
}
if m.Taxitems[i] != nil {
if err := m.Taxitems[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("taxitems" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this order based on the context it is used
func (m *Order) 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.contextValidateContract(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateCoordinate(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateItems(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateShippingaddress(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateTaxitems(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Order) 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 *Order) contextValidateContract(ctx context.Context, formats strfmt.Registry) error {
if m.Contract != nil {
if err := m.Contract.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("contract")
}
return err
}
}
return nil
}
func (m *Order) contextValidateCoordinate(ctx context.Context, formats strfmt.Registry) error {
if m.Coordinate != nil {
if err := m.Coordinate.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("coordinate")
}
return err
}
}
return nil
}
func (m *Order) 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 *Order) 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 *Order) contextValidateTaxitems(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Taxitems); i++ {
if m.Taxitems[i] != nil {
if err := m.Taxitems[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("taxitems" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Order) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Order) UnmarshalBinary(b []byte) error {
var res Order
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}