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

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

	"github.com/taxnexus/go/lib/api/geo/geo_models"
)

// PostCoordinatesReader is a Reader for the PostCoordinates structure.
type PostCoordinatesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCoordinatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostCoordinatesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostCoordinatesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostCoordinatesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostCoordinatesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostCoordinatesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostCoordinatesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}

// NewPostCoordinatesOK creates a PostCoordinatesOK with default headers values
func NewPostCoordinatesOK() *PostCoordinatesOK {
	return &PostCoordinatesOK{}
}

/*PostCoordinatesOK handles this case with default header values.

Taxnexus Response with an array of Coordinate objects
*/
type PostCoordinatesOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *geo_models.CoordinateResponse
}

func (o *PostCoordinatesOK) Error() string {
	return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesOK  %+v", 200, o.Payload)
}

func (o *PostCoordinatesOK) GetPayload() *geo_models.CoordinateResponse {
	return o.Payload
}

func (o *PostCoordinatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	// response header Cache-Control
	o.CacheControl = response.GetHeader("Cache-Control")

	o.Payload = new(geo_models.CoordinateResponse)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCoordinatesUnauthorized creates a PostCoordinatesUnauthorized with default headers values
func NewPostCoordinatesUnauthorized() *PostCoordinatesUnauthorized {
	return &PostCoordinatesUnauthorized{}
}

/*PostCoordinatesUnauthorized handles this case with default header values.

Access unauthorized, invalid API-KEY was used
*/
type PostCoordinatesUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

func (o *PostCoordinatesUnauthorized) Error() string {
	return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesUnauthorized  %+v", 401, o.Payload)
}

func (o *PostCoordinatesUnauthorized) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *PostCoordinatesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(geo_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCoordinatesForbidden creates a PostCoordinatesForbidden with default headers values
func NewPostCoordinatesForbidden() *PostCoordinatesForbidden {
	return &PostCoordinatesForbidden{}
}

/*PostCoordinatesForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type PostCoordinatesForbidden struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

func (o *PostCoordinatesForbidden) Error() string {
	return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesForbidden  %+v", 403, o.Payload)
}

func (o *PostCoordinatesForbidden) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *PostCoordinatesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(geo_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCoordinatesNotFound creates a PostCoordinatesNotFound with default headers values
func NewPostCoordinatesNotFound() *PostCoordinatesNotFound {
	return &PostCoordinatesNotFound{}
}

/*PostCoordinatesNotFound handles this case with default header values.

Resource was not found
*/
type PostCoordinatesNotFound struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

func (o *PostCoordinatesNotFound) Error() string {
	return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesNotFound  %+v", 404, o.Payload)
}

func (o *PostCoordinatesNotFound) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *PostCoordinatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(geo_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCoordinatesUnprocessableEntity creates a PostCoordinatesUnprocessableEntity with default headers values
func NewPostCoordinatesUnprocessableEntity() *PostCoordinatesUnprocessableEntity {
	return &PostCoordinatesUnprocessableEntity{}
}

/*PostCoordinatesUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PostCoordinatesUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

func (o *PostCoordinatesUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *PostCoordinatesUnprocessableEntity) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *PostCoordinatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(geo_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCoordinatesInternalServerError creates a PostCoordinatesInternalServerError with default headers values
func NewPostCoordinatesInternalServerError() *PostCoordinatesInternalServerError {
	return &PostCoordinatesInternalServerError{}
}

/*PostCoordinatesInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostCoordinatesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

func (o *PostCoordinatesInternalServerError) Error() string {
	return fmt.Sprintf("[POST /coordinates][%d] postCoordinatesInternalServerError  %+v", 500, o.Payload)
}

func (o *PostCoordinatesInternalServerError) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *PostCoordinatesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(geo_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}
