// Code generated by go-swagger; DO NOT EDIT.

// All Code Copyright(c) 2018-2020 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"
)

// HarvestPackage harvest package
//
// swagger:model HarvestPackage
type HarvestPackage struct {

	// actual date
	ActualDate string `json:"ActualDate,omitempty"`

	// ingredients
	Ingredients []*HarvestPackageIngredient `json:"Ingredients"`

	// is production batch
	IsProductionBatch bool `json:"IsProductionBatch,omitempty"`

	// item
	Item string `json:"Item,omitempty"`

	// patient license number
	PatientLicenseNumber string `json:"PatientLicenseNumber,omitempty"`

	// product requires remediation
	ProductRequiresRemediation bool `json:"ProductRequiresRemediation,omitempty"`

	// production batch number
	ProductionBatchNumber string `json:"ProductionBatchNumber,omitempty"`

	// remediate product
	RemediateProduct bool `json:"RemediateProduct,omitempty"`

	// remediation date
	RemediationDate string `json:"RemediationDate,omitempty"`

	// remediation method Id
	RemediationMethodID string `json:"RemediationMethodId,omitempty"`

	// remediation steps
	RemediationSteps string `json:"RemediationSteps,omitempty"`

	// room
	Room string `json:"Room,omitempty"`

	// tag
	Tag string `json:"Tag,omitempty"`

	// unit of weight
	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
}

// 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
}
