mirror of
https://github.com/hanzoai/go-fulfillment.git
synced 2026-10-30 18:36:06 +00:00
286 lines
6.1 KiB
Go
286 lines
6.1 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 (
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// StatusType status type
|
|
// swagger:model statusType
|
|
type StatusType struct {
|
|
|
|
// action required by
|
|
ActionRequiredBy *StatusTypeActionRequiredBy `json:"actionRequiredBy,omitempty"`
|
|
|
|
// Code, see [status codes](#section/Getting-Started/Status-Codes)
|
|
// Required: true
|
|
// Pattern: ^\d{6}$
|
|
Code *string `json:"code"`
|
|
|
|
// detail
|
|
Detail string `json:"detail,omitempty"`
|
|
|
|
// detail code
|
|
// Required: true
|
|
// Pattern: ^\d{2}$
|
|
DetailCode *string `json:"detailCode"`
|
|
|
|
// Depricated, use code instead
|
|
ID int64 `json:"id,omitempty"`
|
|
|
|
// Depricated, does this status event close the order
|
|
IsClosed bool `json:"isClosed,omitempty"`
|
|
|
|
// Depricated, use stage/state instead
|
|
Name string `json:"name,omitempty"`
|
|
|
|
// Depricated
|
|
Reason string `json:"reason,omitempty"`
|
|
|
|
// stage
|
|
// Required: true
|
|
Stage *StatusTypeStage `json:"stage"`
|
|
|
|
// state
|
|
// Required: true
|
|
State *StatusTypeState `json:"state"`
|
|
}
|
|
|
|
// Validate validates this status type
|
|
func (m *StatusType) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateActionRequiredBy(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateCode(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateDetailCode(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateStage(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateState(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *StatusType) validateActionRequiredBy(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.ActionRequiredBy) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.ActionRequiredBy != nil {
|
|
if err := m.ActionRequiredBy.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("actionRequiredBy")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *StatusType) validateCode(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("code", "body", m.Code); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.Pattern("code", "body", string(*m.Code), `^\d{6}$`); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *StatusType) validateDetailCode(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("detailCode", "body", m.DetailCode); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.Pattern("detailCode", "body", string(*m.DetailCode), `^\d{2}$`); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *StatusType) validateStage(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("stage", "body", m.Stage); err != nil {
|
|
return err
|
|
}
|
|
|
|
if m.Stage != nil {
|
|
if err := m.Stage.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("stage")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *StatusType) validateState(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("state", "body", m.State); err != nil {
|
|
return err
|
|
}
|
|
|
|
if m.State != nil {
|
|
if err := m.State.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("state")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *StatusType) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *StatusType) UnmarshalBinary(b []byte) error {
|
|
var res StatusType
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|
|
|
|
// StatusTypeActionRequiredBy Responsibility for resolving this issue
|
|
// swagger:model StatusTypeActionRequiredBy
|
|
type StatusTypeActionRequiredBy struct {
|
|
|
|
// id
|
|
ID int64 `json:"id,omitempty"`
|
|
|
|
// Human readable description of responsible party to resolve the issue
|
|
Name string `json:"name,omitempty"`
|
|
}
|
|
|
|
// Validate validates this status type action required by
|
|
func (m *StatusTypeActionRequiredBy) Validate(formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *StatusTypeActionRequiredBy) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *StatusTypeActionRequiredBy) UnmarshalBinary(b []byte) error {
|
|
var res StatusTypeActionRequiredBy
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|
|
|
|
// StatusTypeStage status type stage
|
|
// swagger:model StatusTypeStage
|
|
type StatusTypeStage struct {
|
|
|
|
// code
|
|
Code string `json:"code,omitempty"`
|
|
|
|
// name
|
|
Name string `json:"name,omitempty"`
|
|
}
|
|
|
|
// Validate validates this status type stage
|
|
func (m *StatusTypeStage) Validate(formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *StatusTypeStage) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *StatusTypeStage) UnmarshalBinary(b []byte) error {
|
|
var res StatusTypeStage
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|
|
|
|
// StatusTypeState status type state
|
|
// swagger:model StatusTypeState
|
|
type StatusTypeState struct {
|
|
|
|
// code
|
|
Code string `json:"code,omitempty"`
|
|
|
|
// name
|
|
Name string `json:"name,omitempty"`
|
|
}
|
|
|
|
// Validate validates this status type state
|
|
func (m *StatusTypeState) Validate(formats strfmt.Registry) error {
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *StatusTypeState) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *StatusTypeState) UnmarshalBinary(b []byte) error {
|
|
var res StatusTypeState
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|