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

162 lines
3.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 (
"context"
"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
// Example: string
ArchivedDate string `json:"ArchivedDate,omitempty"`
// caregiver license number
CaregiverLicenseNumber string `json:"CaregiverLicenseNumber,omitempty"`
// Id
// Example: 38304110
ID float64 `json:"Id,omitempty"`
// identification method
IdentificationMethod string `json:"IdentificationMethod,omitempty"`
// is final
// Example: false
IsFinal bool `json:"IsFinal,omitempty"`
// last modified
// Example: 2019-02-14T23:52:31+00:00
LastModified string `json:"LastModified,omitempty"`
// patient license number
PatientLicenseNumber string `json:"PatientLicenseNumber,omitempty"`
// receipt number
// Example: 38304110
ReceiptNumber string `json:"ReceiptNumber,omitempty"`
// sales customer type
// Example: Consumer
SalesCustomerType string `json:"SalesCustomerType,omitempty"`
// sales date time
// Example: 2019-02-14T15:50:45.000
SalesDateTime string `json:"SalesDateTime,omitempty"`
// total packages
// Example: 3
TotalPackages float64 `json:"TotalPackages,omitempty"`
// total price
// Example: 60.83
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
}
// ContextValidate validate this sales receipt based on the context it is used
func (m *SalesReceipt) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateTransactions(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *SalesReceipt) contextValidateTransactions(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Transactions); i++ {
if m.Transactions[i] != nil {
if err := m.Transactions[i].ContextValidate(ctx, 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
}