lib/api/geo/geo_models/coordinate.go

248 lines
5.7 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 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 (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Coordinate coordinate
//
// swagger:model Coordinate
type Coordinate struct {
// Geocoder Country
Country string `json:"Country,omitempty"`
// Taxnexus Country ID
CountryID string `json:"CountryID,omitempty"`
// Geocoder County
County string `json:"County,omitempty"`
// Taxnexus County ID
CountyID string `json:"CountyID,omitempty"`
// The Taxnexus ID of the user who created this record
CreatedByID string `json:"CreatedByID,omitempty"`
// The creation date of this database record
CreatedDate string `json:"CreatedDate,omitempty"`
// Situs Focus for tax determination
Focus string `json:"Focus,omitempty"`
// Formatted Address from Geocoder
FormattedAddress string `json:"FormattedAddress,omitempty"`
// Taxnexus Coordinate Record Id
ID string `json:"ID,omitempty"`
// Situs Incorporated District?
IsDistrict bool `json:"IsDistrict,omitempty"`
// The Taxnexus ID of the user last modified this record
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// The last modification date of this database record
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// Latitude of coordinate
Latitude float64 `json:"Latitude,omitempty"`
// Longitude of coordinate
Longitude float64 `json:"Longitude,omitempty"`
// Google map image
// Format: byte
Map strfmt.Base64 `json:"Map,omitempty"`
// Coordinate Name from Search Text
Name string `json:"Name,omitempty"`
// Geocoder Neighborhood
Neighborhood string `json:"Neighborhood,omitempty"`
// The Taxnexus ID of the user who owns this record
OwnerID string `json:"OwnerID,omitempty"`
// Geocoder Place
Place string `json:"Place,omitempty"`
// The Taxnexus Geocode for this rated location (place or county)
PlaceGeocode string `json:"PlaceGeocode,omitempty"`
// Taxnexus Place ID
PlaceID string `json:"PlaceID,omitempty"`
// Geocoder Postal Code
PostalCode string `json:"PostalCode,omitempty"`
// External System reference ID
Ref string `json:"Ref,omitempty"`
// Geocoder State/Province name
State string `json:"State,omitempty"`
// Taxnexus State ID
StateID string `json:"StateID,omitempty"`
// The Status of the coordinate in Taxnexus
Status string `json:"Status,omitempty"`
// Geocoder Street Name (only)
Street string `json:"Street,omitempty"`
// Geocoder Streen number
StreetNumber string `json:"StreetNumber,omitempty"`
// Google street view image
// Format: byte
StreetView strfmt.Base64 `json:"StreetView,omitempty"`
// tax rate
TaxRate *TaxRate `json:"TaxRate,omitempty"`
// tax types
TaxTypes []*TaxType `json:"TaxTypes"`
}
// Validate validates this coordinate
func (m *Coordinate) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateTaxRate(formats); err != nil {
res = append(res, err)
}
if err := m.validateTaxTypes(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Coordinate) validateTaxRate(formats strfmt.Registry) error {
if swag.IsZero(m.TaxRate) { // not required
return nil
}
if m.TaxRate != nil {
if err := m.TaxRate.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("TaxRate")
}
return err
}
}
return nil
}
func (m *Coordinate) 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
}
// ContextValidate validate this coordinate based on the context it is used
func (m *Coordinate) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateTaxRate(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateTaxTypes(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Coordinate) contextValidateTaxRate(ctx context.Context, formats strfmt.Registry) error {
if m.TaxRate != nil {
if err := m.TaxRate.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("TaxRate")
}
return err
}
}
return nil
}
func (m *Coordinate) 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
}
// MarshalBinary interface implementation
func (m *Coordinate) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Coordinate) UnmarshalBinary(b []byte) error {
var res Coordinate
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}