169 lines
3.9 KiB
Go
169 lines
3.9 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"
|
|
)
|
|
|
|
// HarvestPackage harvest package
|
|
//
|
|
// swagger:model HarvestPackage
|
|
type HarvestPackage struct {
|
|
|
|
// actual date
|
|
// Example: 2015-12-15
|
|
ActualDate string `json:"ActualDate,omitempty"`
|
|
|
|
// ingredients
|
|
Ingredients []*HarvestPackageIngredient `json:"Ingredients"`
|
|
|
|
// is production batch
|
|
// Example: false
|
|
IsProductionBatch bool `json:"IsProductionBatch,omitempty"`
|
|
|
|
// item
|
|
// Example: Buds
|
|
Item string `json:"Item,omitempty"`
|
|
|
|
// patient license number
|
|
// Example: X00001
|
|
PatientLicenseNumber string `json:"PatientLicenseNumber,omitempty"`
|
|
|
|
// product requires remediation
|
|
// Example: false
|
|
ProductRequiresRemediation bool `json:"ProductRequiresRemediation,omitempty"`
|
|
|
|
// production batch number
|
|
// Example: _string_
|
|
ProductionBatchNumber string `json:"ProductionBatchNumber,omitempty"`
|
|
|
|
// remediate product
|
|
// Example: false
|
|
RemediateProduct bool `json:"RemediateProduct,omitempty"`
|
|
|
|
// remediation date
|
|
// Example: 2015-12-15
|
|
RemediationDate string `json:"RemediationDate,omitempty"`
|
|
|
|
// remediation method Id
|
|
// Example: _string_
|
|
RemediationMethodID string `json:"RemediationMethodId,omitempty"`
|
|
|
|
// remediation steps
|
|
// Example: _string_
|
|
RemediationSteps string `json:"RemediationSteps,omitempty"`
|
|
|
|
// room
|
|
// Example: _string_
|
|
Room string `json:"Room,omitempty"`
|
|
|
|
// tag
|
|
// Example: ABCDEF012345670000020201
|
|
Tag string `json:"Tag,omitempty"`
|
|
|
|
// unit of weight
|
|
// Example: Grams
|
|
UnitOfWeight string `json:"UnitOfWeight,omitempty"`
|
|
}
|
|
|
|
// Validate validates this harvest package
|
|
func (m *HarvestPackage) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateIngredients(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *HarvestPackage) validateIngredients(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.Ingredients) { // not required
|
|
return nil
|
|
}
|
|
|
|
for i := 0; i < len(m.Ingredients); i++ {
|
|
if swag.IsZero(m.Ingredients[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Ingredients[i] != nil {
|
|
if err := m.Ingredients[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("Ingredients" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this harvest package based on the context it is used
|
|
func (m *HarvestPackage) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateIngredients(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *HarvestPackage) contextValidateIngredients(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.Ingredients); i++ {
|
|
|
|
if m.Ingredients[i] != nil {
|
|
if err := m.Ingredients[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("Ingredients" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *HarvestPackage) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *HarvestPackage) UnmarshalBinary(b []byte) error {
|
|
var res HarvestPackage
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|