lib/api/metrc-gw/metrc_gw_models/sales_receipt.go

121 lines
2.7 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 metrc_gw_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// SalesReceipt sales receipt
//
// swagger:model SalesReceipt
type SalesReceipt struct {
// archived date
ArchivedDate string `json:"ArchivedDate,omitempty"`
// caregiver license number
CaregiverLicenseNumber string `json:"CaregiverLicenseNumber,omitempty"`
// Id
ID float64 `json:"Id,omitempty"`
// identification method
IdentificationMethod string `json:"IdentificationMethod,omitempty"`
// is final
IsFinal bool `json:"IsFinal,omitempty"`
// last modified
LastModified string `json:"LastModified,omitempty"`
// patient license number
PatientLicenseNumber string `json:"PatientLicenseNumber,omitempty"`
// receipt number
ReceiptNumber string `json:"ReceiptNumber,omitempty"`
// sales customer type
SalesCustomerType string `json:"SalesCustomerType,omitempty"`
// sales date time
SalesDateTime string `json:"SalesDateTime,omitempty"`
// total packages
TotalPackages float64 `json:"TotalPackages,omitempty"`
// total price
TotalPrice float64 `json:"TotalPrice,omitempty"`
// transactions
Transactions []*Transaction `json:"Transactions"`
}
// Validate validates this sales receipt
func (m *SalesReceipt) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateTransactions(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *SalesReceipt) validateTransactions(formats strfmt.Registry) error {
if swag.IsZero(m.Transactions) { // not required
return nil
}
for i := 0; i < len(m.Transactions); i++ {
if swag.IsZero(m.Transactions[i]) { // not required
continue
}
if m.Transactions[i] != nil {
if err := m.Transactions[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Transactions" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *SalesReceipt) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *SalesReceipt) UnmarshalBinary(b []byte) error {
var res SalesReceipt
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}