lib/api/geo/geo_models/coordinate_basic.go

147 lines
3.4 KiB
Go
Raw Permalink Normal View History

2021-01-08 17:40:28 +00:00
// Code generated by go-swagger; DO NOT EDIT.
2021-01-19 16:58:40 +00:00
// All Code Copyright(c) 2018-2021 by Taxnexus, Inc.
2021-01-08 17:40:28 +00:00
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package geo_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
2021-02-09 16:56:57 +00:00
"context"
2021-01-08 17:40:28 +00:00
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// CoordinateBasic Minimized version of full Coordinate record; should contain just enough data for tax rating purposes
//
// swagger:model CoordinateBasic
type CoordinateBasic struct {
// Taxnexus Country ID
CountryID string `json:"CountryID,omitempty"`
// Taxnexus County ID
CountyID string `json:"CountyID,omitempty"`
// Situs Focus for tax determination
Focus string `json:"Focus,omitempty"`
// Taxnexus Coordinate Record Id
ID string `json:"ID,omitempty"`
// Situs Incorporated District?
IsDistrict bool `json:"IsDistrict,omitempty"`
// Coordinate Name from Search Text
Name string `json:"Name,omitempty"`
// The Taxnexus Geocode for this rated location (place or county)
PlaceGeocode string `json:"PlaceGeocode,omitempty"`
// Taxnexus Place ID
PlaceID string `json:"PlaceID,omitempty"`
// External System reference ID
Ref string `json:"Ref,omitempty"`
// Taxnexus State ID
StateID string `json:"StateID,omitempty"`
// tax types
TaxTypes []*TaxTypeID `json:"TaxTypes"`
}
// Validate validates this coordinate basic
func (m *CoordinateBasic) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateTaxTypes(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CoordinateBasic) validateTaxTypes(formats strfmt.Registry) error {
if swag.IsZero(m.TaxTypes) { // not required
return nil
}
for i := 0; i < len(m.TaxTypes); i++ {
if swag.IsZero(m.TaxTypes[i]) { // not required
continue
}
if m.TaxTypes[i] != nil {
if err := m.TaxTypes[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("TaxTypes" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
2021-02-09 16:56:57 +00:00
// ContextValidate validate this coordinate basic based on the context it is used
func (m *CoordinateBasic) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateTaxTypes(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CoordinateBasic) contextValidateTaxTypes(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.TaxTypes); i++ {
if m.TaxTypes[i] != nil {
if err := m.TaxTypes[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("TaxTypes" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
2021-01-08 17:40:28 +00:00
// MarshalBinary interface implementation
func (m *CoordinateBasic) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CoordinateBasic) UnmarshalBinary(b []byte) error {
var res CoordinateBasic
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}