mirror of
https://github.com/hanzoai/go-fulfillment.git
synced 2026-10-30 18:36:06 +00:00
267 lines
5.2 KiB
Go
267 lines
5.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 (
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// Consignee consignee
|
|
// swagger:model consignee
|
|
type Consignee struct {
|
|
|
|
// address1
|
|
// Required: true
|
|
Address1 *string `json:"address1"`
|
|
|
|
// address2
|
|
Address2 string `json:"address2,omitempty"`
|
|
|
|
// City
|
|
// Required: true
|
|
AddressLocality *string `json:"addressLocality"`
|
|
|
|
// Province / State
|
|
// Required: true
|
|
AddressRegion *string `json:"addressRegion"`
|
|
|
|
// company name
|
|
CompanyName string `json:"companyName,omitempty"`
|
|
|
|
// Ideally provide the two character ISO code
|
|
// Required: true
|
|
Country *string `json:"country"`
|
|
|
|
// email
|
|
Email string `json:"email,omitempty"`
|
|
|
|
// first name
|
|
// Required: true
|
|
FirstName *string `json:"firstName"`
|
|
|
|
// id
|
|
// Required: true
|
|
ID *int64 `json:"id"`
|
|
|
|
// iso
|
|
Iso *IsoCountry `json:"iso,omitempty"`
|
|
|
|
// last name
|
|
// Required: true
|
|
LastName *string `json:"lastName"`
|
|
|
|
// phone
|
|
Phone string `json:"phone,omitempty"`
|
|
|
|
// Postal Code / Zip
|
|
// Required: true
|
|
PostalCode *string `json:"postalCode"`
|
|
|
|
// updated at
|
|
// Format: date-time
|
|
UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"`
|
|
|
|
// updated by
|
|
UpdatedBy *User `json:"updatedBy,omitempty"`
|
|
}
|
|
|
|
// Validate validates this consignee
|
|
func (m *Consignee) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateAddress1(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateAddressLocality(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateAddressRegion(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateCountry(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateFirstName(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateIso(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateLastName(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validatePostalCode(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateUpdatedAt(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateUpdatedBy(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *Consignee) validateAddress1(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("address1", "body", m.Address1); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Consignee) validateAddressLocality(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("addressLocality", "body", m.AddressLocality); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Consignee) validateAddressRegion(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("addressRegion", "body", m.AddressRegion); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Consignee) validateCountry(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("country", "body", m.Country); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Consignee) validateFirstName(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("firstName", "body", m.FirstName); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Consignee) validateID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("id", "body", m.ID); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Consignee) validateIso(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.Iso) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.Iso != nil {
|
|
if err := m.Iso.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("iso")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Consignee) validateLastName(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("lastName", "body", m.LastName); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Consignee) validatePostalCode(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("postalCode", "body", m.PostalCode); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Consignee) validateUpdatedAt(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.UpdatedAt) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *Consignee) validateUpdatedBy(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.UpdatedBy) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.UpdatedBy != nil {
|
|
if err := m.UpdatedBy.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("updatedBy")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *Consignee) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *Consignee) UnmarshalBinary(b []byte) error {
|
|
var res Consignee
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|