mirror of
https://github.com/hanzoai/go-fulfillment.git
synced 2026-10-30 18:36:06 +00:00
139 lines
2.7 KiB
Go
139 lines
2.7 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"
|
|
)
|
|
|
|
// StatusEvent status event
|
|
// swagger:model statusEvent
|
|
type StatusEvent struct {
|
|
|
|
// created by
|
|
CreatedBy *User `json:"createdBy,omitempty"`
|
|
|
|
// DateTime of Status Event
|
|
// Format: date-time
|
|
Date strfmt.DateTime `json:"date,omitempty"`
|
|
|
|
// id
|
|
// Required: true
|
|
ID *int64 `json:"id"`
|
|
|
|
// Explanation for status
|
|
Reason string `json:"reason,omitempty"`
|
|
|
|
// status
|
|
Status *StatusType `json:"status,omitempty"`
|
|
}
|
|
|
|
// Validate validates this status event
|
|
func (m *StatusEvent) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateCreatedBy(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateDate(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateStatus(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *StatusEvent) validateCreatedBy(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.CreatedBy) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.CreatedBy != nil {
|
|
if err := m.CreatedBy.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("createdBy")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *StatusEvent) validateDate(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.Date) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.FormatOf("date", "body", "date-time", m.Date.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *StatusEvent) validateID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("id", "body", m.ID); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *StatusEvent) validateStatus(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.Status) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Status != nil {
|
|
if err := m.Status.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("status")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *StatusEvent) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *StatusEvent) UnmarshalBinary(b []byte) error {
|
|
var res StatusEvent
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|