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

// 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/sf-gate/sf_gate_models"
)

// GetStatesReader is a Reader for the GetStates structure.
type GetStatesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetStatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetStatesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetStatesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetStatesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetStatesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetStatesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetStatesInternalServerError()
		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())
	}
}

// NewGetStatesOK creates a GetStatesOK with default headers values
func NewGetStatesOK() *GetStatesOK {
	return &GetStatesOK{}
}

/*GetStatesOK handles this case with default header values.

Taxnexus Response with an array of State objects
*/
type GetStatesOK struct {
	Payload *sf_gate_models.StateResponse
}

func (o *GetStatesOK) Error() string {
	return fmt.Sprintf("[GET /states][%d] getStatesOK  %+v", 200, o.Payload)
}

func (o *GetStatesOK) GetPayload() *sf_gate_models.StateResponse {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.StateResponse)

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

	return nil
}

// NewGetStatesUnauthorized creates a GetStatesUnauthorized with default headers values
func NewGetStatesUnauthorized() *GetStatesUnauthorized {
	return &GetStatesUnauthorized{}
}

/*GetStatesUnauthorized handles this case with default header values.

Access unauthorized, invalid API-KEY was used
*/
type GetStatesUnauthorized struct {
	Payload *sf_gate_models.Error
}

func (o *GetStatesUnauthorized) Error() string {
	return fmt.Sprintf("[GET /states][%d] getStatesUnauthorized  %+v", 401, o.Payload)
}

func (o *GetStatesUnauthorized) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewGetStatesForbidden creates a GetStatesForbidden with default headers values
func NewGetStatesForbidden() *GetStatesForbidden {
	return &GetStatesForbidden{}
}

/*GetStatesForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type GetStatesForbidden struct {
	Payload *sf_gate_models.Error
}

func (o *GetStatesForbidden) Error() string {
	return fmt.Sprintf("[GET /states][%d] getStatesForbidden  %+v", 403, o.Payload)
}

func (o *GetStatesForbidden) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewGetStatesNotFound creates a GetStatesNotFound with default headers values
func NewGetStatesNotFound() *GetStatesNotFound {
	return &GetStatesNotFound{}
}

/*GetStatesNotFound handles this case with default header values.

Resource was not found
*/
type GetStatesNotFound struct {
	Payload *sf_gate_models.Error
}

func (o *GetStatesNotFound) Error() string {
	return fmt.Sprintf("[GET /states][%d] getStatesNotFound  %+v", 404, o.Payload)
}

func (o *GetStatesNotFound) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewGetStatesUnprocessableEntity creates a GetStatesUnprocessableEntity with default headers values
func NewGetStatesUnprocessableEntity() *GetStatesUnprocessableEntity {
	return &GetStatesUnprocessableEntity{}
}

/*GetStatesUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type GetStatesUnprocessableEntity struct {
	Payload *sf_gate_models.Error
}

func (o *GetStatesUnprocessableEntity) Error() string {
	return fmt.Sprintf("[GET /states][%d] getStatesUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *GetStatesUnprocessableEntity) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewGetStatesInternalServerError creates a GetStatesInternalServerError with default headers values
func NewGetStatesInternalServerError() *GetStatesInternalServerError {
	return &GetStatesInternalServerError{}
}

/*GetStatesInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetStatesInternalServerError struct {
	Payload *sf_gate_models.Error
}

func (o *GetStatesInternalServerError) Error() string {
	return fmt.Sprintf("[GET /states][%d] getStatesInternalServerError  %+v", 500, o.Payload)
}

func (o *GetStatesInternalServerError) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}
