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

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// New creates a new coordinate API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
	return &Client{transport: transport, formats: formats}
}

/*
Client for coordinate API
*/
type Client struct {
	transport runtime.ClientTransport
	formats   strfmt.Registry
}

// ClientService is the interface for Client methods
type ClientService interface {
	DeleteCoordinate(params *DeleteCoordinateParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCoordinateOK, error)

	GetCoordinateBasic(params *GetCoordinateBasicParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinateBasicOK, error)

	GetCoordinateObservable(params *GetCoordinateObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinateObservableOK, error)

	GetCoordinates(params *GetCoordinatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinatesOK, error)

	PostCoordinates(params *PostCoordinatesParams, authInfo runtime.ClientAuthInfoWriter) (*PostCoordinatesOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
  DeleteCoordinate deletes a coordinate

  Delete a Taxneuxs Coordinate record from the Coordinate database
*/
func (a *Client) DeleteCoordinate(params *DeleteCoordinateParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteCoordinateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteCoordinateParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "deleteCoordinate",
		Method:             "DELETE",
		PathPattern:        "/coordinates",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &DeleteCoordinateReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*DeleteCoordinateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for deleteCoordinate: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
  GetCoordinateBasic gets a single taxnexus coordinate from address information

  Response is one minimized Coordinate record including Tax Type IDs
*/
func (a *Client) GetCoordinateBasic(params *GetCoordinateBasicParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinateBasicOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetCoordinateBasicParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "getCoordinateBasic",
		Method:             "GET",
		PathPattern:        "/coordinates/basic",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetCoordinateBasicReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GetCoordinateBasicOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for getCoordinateBasic: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
  GetCoordinateObservable gets a single taxnexus coordinate as an observable array

  Response is one minimized Coordinate record including Tax Type IDs as an observable array
*/
func (a *Client) GetCoordinateObservable(params *GetCoordinateObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinateObservableOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetCoordinateObservableParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "getCoordinateObservable",
		Method:             "GET",
		PathPattern:        "/coordinates/observable",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetCoordinateObservableReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GetCoordinateObservableOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for getCoordinateObservable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
  GetCoordinates gets a single taxnexus coordinate from address information

  Return a fully-populated Coordinate record including Tax Type array
*/
func (a *Client) GetCoordinates(params *GetCoordinatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetCoordinatesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetCoordinatesParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "getCoordinates",
		Method:             "GET",
		PathPattern:        "/coordinates",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetCoordinatesReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GetCoordinatesOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for getCoordinates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
  PostCoordinates processes a batch of coordinate g e t requests

  Processes a batch of Coordinate GET requests and returns an array of Coordinate records including Tax Type IDs
*/
func (a *Client) PostCoordinates(params *PostCoordinatesParams, authInfo runtime.ClientAuthInfoWriter) (*PostCoordinatesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPostCoordinatesParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "postCoordinates",
		Method:             "POST",
		PathPattern:        "/coordinates",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &PostCoordinatesReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*PostCoordinatesOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for postCoordinates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
	a.transport = transport
}
