189 lines
4.1 KiB
Go
189 lines
4.1 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"
|
|
)
|
|
|
|
// PurchaseOrderBasic purchase order basic
|
|
//
|
|
// swagger:model PurchaseOrderBasic
|
|
type PurchaseOrderBasic struct {
|
|
|
|
// Account
|
|
Accountid string `json:"accountid,omitempty"`
|
|
|
|
// Purchase Order Amount
|
|
Amount float64 `json:"amount,omitempty"`
|
|
|
|
// Amount Due
|
|
Amountdue float64 `json:"amountdue,omitempty"`
|
|
|
|
// coordinate
|
|
Coordinate *Address `json:"coordinate,omitempty"`
|
|
|
|
// Order Id
|
|
ID string `json:"id,omitempty"`
|
|
|
|
// items
|
|
Items []*ItemBasic `json:"items"`
|
|
|
|
// Purcahse Order Date
|
|
Podate string `json:"podate,omitempty"`
|
|
|
|
// Purchase Order Number
|
|
Ponumber string `json:"ponumber,omitempty"`
|
|
|
|
// Sales Regulation Type (Medicinal or Recreational)
|
|
Salesregulation string `json:"salesregulation,omitempty"`
|
|
|
|
// Status
|
|
Status string `json:"status,omitempty"`
|
|
|
|
// Subtotal
|
|
Subtotal float64 `json:"subtotal,omitempty"`
|
|
|
|
// Type
|
|
Type string `json:"type,omitempty"`
|
|
}
|
|
|
|
// Validate validates this purchase order basic
|
|
func (m *PurchaseOrderBasic) 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 *PurchaseOrderBasic) 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 *PurchaseOrderBasic) 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
|
|
}
|
|
|
|
// ContextValidate validate this purchase order basic based on the context it is used
|
|
func (m *PurchaseOrderBasic) 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 *PurchaseOrderBasic) 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 *PurchaseOrderBasic) 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
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *PurchaseOrderBasic) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *PurchaseOrderBasic) UnmarshalBinary(b []byte) error {
|
|
var res PurchaseOrderBasic
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|