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

183 lines
3.9 KiB
Go
Raw Permalink Normal View History

2021-01-08 17:40:28 +00:00
// Code generated by go-swagger; DO NOT EDIT.
2021-01-19 16:58:40 +00:00
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
2021-01-08 17:40:28 +00:00
// 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 (
2021-02-09 16:56:57 +00:00
"context"
2021-01-08 17:40:28 +00:00
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// OrderBasic order basic
//
// swagger:model OrderBasic
type OrderBasic struct {
// Account
Accountid string `json:"accountid,omitempty"`
// Order Amount
Amount float64 `json:"amount,omitempty"`
// Amount Due
Amountdue float64 `json:"amountdue,omitempty"`
// coordinate
Coordinate *Address `json:"coordinate,omitempty"`
// Taxnexus Record Id Only; not used in POST
ID string `json:"id,omitempty"`
// items
Items *ItemBasic `json:"items,omitempty"`
// Order Date
Orderdate string `json:"orderdate,omitempty"`
// UUID Reference the master record that owns this item
Parentfk string `json:"parentfk,omitempty"`
// Source System identifier for this record, if any
Ref string `json:"ref,omitempty"`
// Sales Regulation Type (Medicinal or Recreational)
Salesregulation string `json:"salesregulation,omitempty"`
// Status
Status string `json:"status,omitempty"`
// Subtotal
Subtotal float64 `json:"subtotal,omitempty"`
// tenant identifier
Tenantid string `json:"tenantid,omitempty"`
// Type
Type string `json:"type,omitempty"`
}
// Validate validates this order basic
func (m *OrderBasic) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCoordinate(formats); err != nil {
res = append(res, err)
}
if err := m.validateItems(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *OrderBasic) 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 *OrderBasic) validateItems(formats strfmt.Registry) error {
if swag.IsZero(m.Items) { // not required
return nil
}
if m.Items != nil {
if err := m.Items.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("items")
}
return err
}
}
return nil
}
2021-02-09 16:56:57 +00:00
// ContextValidate validate this order basic based on the context it is used
func (m *OrderBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
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 len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *OrderBasic) 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 *OrderBasic) contextValidateItems(ctx context.Context, formats strfmt.Registry) error {
if m.Items != nil {
if err := m.Items.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("items")
}
return err
}
}
return nil
}
2021-01-08 17:40:28 +00:00
// MarshalBinary interface implementation
func (m *OrderBasic) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *OrderBasic) UnmarshalBinary(b []byte) error {
var res OrderBasic
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}