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

169 lines
3.9 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 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 (
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"
)
// HarvestPackage harvest package
//
// swagger:model HarvestPackage
type HarvestPackage struct {
// actual date
2021-02-09 16:56:57 +00:00
// Example: 2015-12-15
2021-01-08 17:40:28 +00:00
ActualDate string `json:"ActualDate,omitempty"`
// ingredients
Ingredients []*HarvestPackageIngredient `json:"Ingredients"`
// is production batch
2021-02-09 16:56:57 +00:00
// Example: false
2021-01-08 17:40:28 +00:00
IsProductionBatch bool `json:"IsProductionBatch,omitempty"`
// item
2021-02-09 16:56:57 +00:00
// Example: Buds
2021-01-08 17:40:28 +00:00
Item string `json:"Item,omitempty"`
// patient license number
2021-02-09 16:56:57 +00:00
// Example: X00001
2021-01-08 17:40:28 +00:00
PatientLicenseNumber string `json:"PatientLicenseNumber,omitempty"`
// product requires remediation
2021-02-09 16:56:57 +00:00
// Example: false
2021-01-08 17:40:28 +00:00
ProductRequiresRemediation bool `json:"ProductRequiresRemediation,omitempty"`
// production batch number
2021-02-09 16:56:57 +00:00
// Example: _string_
2021-01-08 17:40:28 +00:00
ProductionBatchNumber string `json:"ProductionBatchNumber,omitempty"`
// remediate product
2021-02-09 16:56:57 +00:00
// Example: false
2021-01-08 17:40:28 +00:00
RemediateProduct bool `json:"RemediateProduct,omitempty"`
// remediation date
2021-02-09 16:56:57 +00:00
// Example: 2015-12-15
2021-01-08 17:40:28 +00:00
RemediationDate string `json:"RemediationDate,omitempty"`
// remediation method Id
2021-02-09 16:56:57 +00:00
// Example: _string_
2021-01-08 17:40:28 +00:00
RemediationMethodID string `json:"RemediationMethodId,omitempty"`
// remediation steps
2021-02-09 16:56:57 +00:00
// Example: _string_
2021-01-08 17:40:28 +00:00
RemediationSteps string `json:"RemediationSteps,omitempty"`
// room
2021-02-09 16:56:57 +00:00
// Example: _string_
2021-01-08 17:40:28 +00:00
Room string `json:"Room,omitempty"`
// tag
2021-02-09 16:56:57 +00:00
// Example: ABCDEF012345670000020201
2021-01-08 17:40:28 +00:00
Tag string `json:"Tag,omitempty"`
// unit of weight
2021-02-09 16:56:57 +00:00
// Example: Grams
2021-01-08 17:40:28 +00:00
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
}
2021-02-09 16:56:57 +00:00
// 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
}
2021-01-08 17:40:28 +00:00
// 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
}