lib/api/vendor-gw/vendor_gw_models/account_basic.go

300 lines
6.8 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package vendor_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 (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// AccountBasic account basic
//
// swagger:model AccountBasic
type AccountBasic struct {
// Account Number
AccountNumber string `json:"AccountNumber,omitempty"`
// billing address
BillingAddress *Address `json:"BillingAddress,omitempty"`
// billing contact
BillingContact *ContactBasic `json:"BillingContact,omitempty"`
// Taxnexus Record Id Only; not used in POST
ID string `json:"ID,omitempty"`
// license
License *LicenseBasic `json:"License,omitempty"`
// Account Name
Name string `json:"Name,omitempty"`
// UUID Reference the master record that owns this item
ParentFK string `json:"ParentFK,omitempty"`
// Phone number
Phone string `json:"Phone,omitempty"`
// Source System identifier for this record, if any
Ref string `json:"Ref,omitempty"`
// shipping address
ShippingAddress *Address `json:"ShippingAddress,omitempty"`
// shipping contact
ShippingContact *ContactBasic `json:"ShippingContact,omitempty"`
// Account Type
Type string `json:"Type,omitempty"`
// Unique Taxnexus ID
UUID string `json:"UUID,omitempty"`
// Account Website
Website string `json:"Website,omitempty"`
}
// Validate validates this account basic
func (m *AccountBasic) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBillingAddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateBillingContact(formats); err != nil {
res = append(res, err)
}
if err := m.validateLicense(formats); err != nil {
res = append(res, err)
}
if err := m.validateShippingAddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateShippingContact(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *AccountBasic) validateBillingAddress(formats strfmt.Registry) error {
if swag.IsZero(m.BillingAddress) { // not required
return nil
}
if m.BillingAddress != nil {
if err := m.BillingAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BillingAddress")
}
return err
}
}
return nil
}
func (m *AccountBasic) validateBillingContact(formats strfmt.Registry) error {
if swag.IsZero(m.BillingContact) { // not required
return nil
}
if m.BillingContact != nil {
if err := m.BillingContact.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BillingContact")
}
return err
}
}
return nil
}
func (m *AccountBasic) validateLicense(formats strfmt.Registry) error {
if swag.IsZero(m.License) { // not required
return nil
}
if m.License != nil {
if err := m.License.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("License")
}
return err
}
}
return nil
}
func (m *AccountBasic) validateShippingAddress(formats strfmt.Registry) error {
if swag.IsZero(m.ShippingAddress) { // not required
return nil
}
if m.ShippingAddress != nil {
if err := m.ShippingAddress.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ShippingAddress")
}
return err
}
}
return nil
}
func (m *AccountBasic) validateShippingContact(formats strfmt.Registry) error {
if swag.IsZero(m.ShippingContact) { // not required
return nil
}
if m.ShippingContact != nil {
if err := m.ShippingContact.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ShippingContact")
}
return err
}
}
return nil
}
// ContextValidate validate this account basic based on the context it is used
func (m *AccountBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateBillingAddress(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateBillingContact(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateLicense(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateShippingAddress(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateShippingContact(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *AccountBasic) contextValidateBillingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.BillingAddress != nil {
if err := m.BillingAddress.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BillingAddress")
}
return err
}
}
return nil
}
func (m *AccountBasic) contextValidateBillingContact(ctx context.Context, formats strfmt.Registry) error {
if m.BillingContact != nil {
if err := m.BillingContact.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("BillingContact")
}
return err
}
}
return nil
}
func (m *AccountBasic) contextValidateLicense(ctx context.Context, formats strfmt.Registry) error {
if m.License != nil {
if err := m.License.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("License")
}
return err
}
}
return nil
}
func (m *AccountBasic) contextValidateShippingAddress(ctx context.Context, formats strfmt.Registry) error {
if m.ShippingAddress != nil {
if err := m.ShippingAddress.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ShippingAddress")
}
return err
}
}
return nil
}
func (m *AccountBasic) contextValidateShippingContact(ctx context.Context, formats strfmt.Registry) error {
if m.ShippingContact != nil {
if err := m.ShippingContact.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ShippingContact")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *AccountBasic) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *AccountBasic) UnmarshalBinary(b []byte) error {
var res AccountBasic
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}