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

189 lines
4.7 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"
)
// SalesDelivery sales delivery
//
// swagger:model SalesDelivery
type SalesDelivery struct {
// driver name
2021-02-09 16:56:57 +00:00
// Example: John Doe
2021-01-08 17:40:28 +00:00
DriverName string `json:"DriverName,omitempty"`
// driver occupational license number
2021-02-09 16:56:57 +00:00
// Example: 1
2021-01-08 17:40:28 +00:00
DriverOccupationalLicenseNumber string `json:"DriverOccupationalLicenseNumber,omitempty"`
// driver vehicle license number
2021-02-09 16:56:57 +00:00
// Example: 1
2021-01-08 17:40:28 +00:00
DriverVehicleLicenseNumber string `json:"DriverVehicleLicenseNumber,omitempty"`
// estimated arrival date time
2021-02-09 16:56:57 +00:00
// Example: 2017-04-04T13:00:00.000
2021-01-08 17:40:28 +00:00
EstimatedArrivalDateTime string `json:"EstimatedArrivalDateTime,omitempty"`
// estimated departure date time
2021-02-09 16:56:57 +00:00
// Example: 2017-04-04T11:00:00.000
2021-01-08 17:40:28 +00:00
EstimatedDepartureDateTime string `json:"EstimatedDepartureDateTime,omitempty"`
// Id
2021-02-09 16:56:57 +00:00
// Example: 51
2021-01-08 17:40:28 +00:00
ID float64 `json:"Id,omitempty"`
// phone number for questions
2021-02-09 16:56:57 +00:00
// Example: +1-123-456-7890
2021-01-08 17:40:28 +00:00
PhoneNumberForQuestions string `json:"PhoneNumberForQuestions,omitempty"`
// planned route
2021-02-09 16:56:57 +00:00
// Example: Drive to destination.
2021-01-08 17:40:28 +00:00
PlannedRoute string `json:"PlannedRoute,omitempty"`
// recipient address city
2021-02-09 16:56:57 +00:00
// Example: Denver
2021-01-08 17:40:28 +00:00
RecipientAddressCity string `json:"RecipientAddressCity,omitempty"`
// recipient address postal code
2021-02-09 16:56:57 +00:00
// Example: 11111
2021-01-08 17:40:28 +00:00
RecipientAddressPostalCode string `json:"RecipientAddressPostalCode,omitempty"`
// recipient address state
2021-02-09 16:56:57 +00:00
// Example: CO
2021-01-08 17:40:28 +00:00
RecipientAddressState string `json:"RecipientAddressState,omitempty"`
// recipient address street1
2021-02-09 16:56:57 +00:00
// Example: 1 Someplace Road
2021-01-08 17:40:28 +00:00
RecipientAddressStreet1 string `json:"RecipientAddressStreet1,omitempty"`
// recipient address street2
2021-02-09 16:56:57 +00:00
// Example: Ste 9
2021-01-08 17:40:28 +00:00
RecipientAddressStreet2 string `json:"RecipientAddressStreet2,omitempty"`
// sales customer type
2021-02-09 16:56:57 +00:00
// Example: Consumer
2021-01-08 17:40:28 +00:00
SalesCustomerType string `json:"SalesCustomerType,omitempty"`
// sales date time
2021-02-09 16:56:57 +00:00
// Example: 2017-04-04T10:10:19.000
2021-01-08 17:40:28 +00:00
SalesDateTime string `json:"SalesDateTime,omitempty"`
// transactions
Transactions []*Transaction `json:"Transactions"`
// vehicle license plate number
2021-02-09 16:56:57 +00:00
// Example: 000000
2021-01-08 17:40:28 +00:00
VehicleLicensePlateNumber string `json:"VehicleLicensePlateNumber,omitempty"`
// vehicle make
2021-02-09 16:56:57 +00:00
// Example: Car
2021-01-08 17:40:28 +00:00
VehicleMake string `json:"VehicleMake,omitempty"`
// vehicle model
2021-02-09 16:56:57 +00:00
// Example: Small
2021-01-08 17:40:28 +00:00
VehicleModel string `json:"VehicleModel,omitempty"`
}
// Validate validates this sales delivery
func (m *SalesDelivery) 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 *SalesDelivery) 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
}
2021-02-09 16:56:57 +00:00
// ContextValidate validate this sales delivery based on the context it is used
func (m *SalesDelivery) 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 *SalesDelivery) 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
}
2021-01-08 17:40:28 +00:00
// MarshalBinary interface implementation
func (m *SalesDelivery) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *SalesDelivery) UnmarshalBinary(b []byte) error {
var res SalesDelivery
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}