mirror of
https://github.com/hanzoai/go-fulfillment.git
synced 2026-10-30 18:36:06 +00:00
385 lines
8.2 KiB
Go
385 lines
8.2 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package 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"
|
|
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// Order order
|
|
// swagger:model order
|
|
type Order struct {
|
|
|
|
// current status
|
|
// Required: true
|
|
CurrentStatus *StatusEvent `json:"currentStatus"`
|
|
|
|
// DateTime order departed an FDC warehouse
|
|
// Format: date-time
|
|
DepartDate strfmt.DateTime `json:"departDate,omitempty"`
|
|
|
|
// DateTime order was dispatched for fulfillment by FDC
|
|
// Format: date-time
|
|
DispatchDate strfmt.DateTime `json:"dispatchDate,omitempty"`
|
|
|
|
// FDC ID for this order
|
|
// Required: true
|
|
ID *int64 `json:"id"`
|
|
|
|
// merchant
|
|
// Required: true
|
|
Merchant *Merchant `json:"merchant"`
|
|
|
|
// Merchant provided ID
|
|
// Required: true
|
|
MerchantOrderID *string `json:"merchantOrderId"`
|
|
|
|
// Requested ship method
|
|
// Required: true
|
|
MerchantShippingMethod *string `json:"merchantShippingMethod"`
|
|
|
|
// original consignee
|
|
// Required: true
|
|
OriginalConsignee *Consignee `json:"originalConsignee"`
|
|
|
|
// parent order
|
|
ParentOrder *OrderParentOrder `json:"parentOrder,omitempty"`
|
|
|
|
// Merchant provided PO#
|
|
PurchaseOrderNum string `json:"purchaseOrderNum,omitempty"`
|
|
|
|
// DateTime order was recorded by FDC
|
|
// Required: true
|
|
// Format: date-time
|
|
RecordedOn *strfmt.DateTime `json:"recordedOn"`
|
|
|
|
// tracking numbers
|
|
TrackingNumbers []*TrackingNumber `json:"trackingNumbers"`
|
|
|
|
// validated consignee
|
|
// Required: true
|
|
ValidatedConsignee *Consignee `json:"validatedConsignee"`
|
|
|
|
// warehouse
|
|
Warehouse *Warehouse `json:"warehouse,omitempty"`
|
|
}
|
|
|
|
// Validate validates this order
|
|
func (m *Order) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateCurrentStatus(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateDepartDate(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateDispatchDate(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateMerchant(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateMerchantOrderID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateMerchantShippingMethod(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateOriginalConsignee(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateParentOrder(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRecordedOn(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTrackingNumbers(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateValidatedConsignee(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateWarehouse(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateCurrentStatus(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("currentStatus", "body", m.CurrentStatus); err != nil {
|
|
return err
|
|
}
|
|
|
|
if m.CurrentStatus != nil {
|
|
if err := m.CurrentStatus.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("currentStatus")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateDepartDate(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.DepartDate) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.FormatOf("departDate", "body", "date-time", m.DepartDate.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateDispatchDate(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.DispatchDate) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.FormatOf("dispatchDate", "body", "date-time", m.DispatchDate.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("id", "body", m.ID); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateMerchant(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("merchant", "body", m.Merchant); err != nil {
|
|
return err
|
|
}
|
|
|
|
if m.Merchant != nil {
|
|
if err := m.Merchant.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("merchant")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateMerchantOrderID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("merchantOrderId", "body", m.MerchantOrderID); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateMerchantShippingMethod(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("merchantShippingMethod", "body", m.MerchantShippingMethod); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateOriginalConsignee(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("originalConsignee", "body", m.OriginalConsignee); err != nil {
|
|
return err
|
|
}
|
|
|
|
if m.OriginalConsignee != nil {
|
|
if err := m.OriginalConsignee.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("originalConsignee")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateParentOrder(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.ParentOrder) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.ParentOrder != nil {
|
|
if err := m.ParentOrder.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("parentOrder")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateRecordedOn(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("recordedOn", "body", m.RecordedOn); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("recordedOn", "body", "date-time", m.RecordedOn.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateTrackingNumbers(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.TrackingNumbers) { // not required
|
|
return nil
|
|
}
|
|
|
|
for i := 0; i < len(m.TrackingNumbers); i++ {
|
|
if swag.IsZero(m.TrackingNumbers[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.TrackingNumbers[i] != nil {
|
|
if err := m.TrackingNumbers[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("trackingNumbers" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateValidatedConsignee(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("validatedConsignee", "body", m.ValidatedConsignee); err != nil {
|
|
return err
|
|
}
|
|
|
|
if m.ValidatedConsignee != nil {
|
|
if err := m.ValidatedConsignee.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("validatedConsignee")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Order) validateWarehouse(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.Warehouse) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Warehouse != nil {
|
|
if err := m.Warehouse.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("warehouse")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *Order) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *Order) UnmarshalBinary(b []byte) error {
|
|
var res Order
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|
|
|
|
// OrderParentOrder order parent order
|
|
// swagger:model OrderParentOrder
|
|
type OrderParentOrder struct {
|
|
|
|
// Reference to parent `id` if order was grouped
|
|
ID int64 `json:"id,omitempty"`
|
|
}
|
|
|
|
// Validate validates this order parent order
|
|
func (m *OrderParentOrder) Validate(formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *OrderParentOrder) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *OrderParentOrder) UnmarshalBinary(b []byte) error {
|
|
var res OrderParentOrder
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|