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

195 lines
4.2 KiB
Go
Raw 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
"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
Accountid string `json:"accountid,omitempty"`
// Quote 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 []*QuoteItemBasic `json:"items"`
// UUID Reference the master record that owns this item
Parentfk string `json:"parentfk,omitempty"`
// Quote Date
Quotedate string `json:"quotedate,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 quote basic
func (m *QuoteBasic) 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 *QuoteBasic) 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 *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
}
2021-02-09 16:56:57 +00:00
// 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.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 *QuoteBasic) 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 *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
}
2021-01-08 17:40:28 +00:00
// 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
}