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

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