// Code generated by go-swagger; DO NOT EDIT.

// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package gov_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 (
	"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"`

	// 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"`

	// Latitude of coordinate
	Latitude float64 `json:"latitude,omitempty"`

	// Longitude of coordinate
	Longitude float64 `json:"longitude,omitempty"`

	// Coordinate Name from Search Text
	Name string `json:"name,omitempty"`

	// Geocoder Neighborhood
	Neighborhood string `json:"neighborhood,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"`

	// taxtypes
	Taxtypes []*TaxTypeID `json:"taxtypes"`

	// Unique identifier assigned at creation
	UUID string `json:"uuid,omitempty"`
}

// Validate validates this coordinate
func (m *Coordinate) 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 *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
}

// 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
}
