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

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

package industry

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"code.tnxs.net/vernonkeenan/lib/api/research/research_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// GetIndustriesReader is a Reader for the GetIndustries structure.
type GetIndustriesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetIndustriesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetIndustriesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetIndustriesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetIndustriesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetIndustriesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetIndustriesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetIndustriesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /industries] getIndustries", response, response.Code())
	}
}

// NewGetIndustriesOK creates a GetIndustriesOK with default headers values
func NewGetIndustriesOK() *GetIndustriesOK {
	return &GetIndustriesOK{}
}

// GetIndustriesOK describes a response with status code 200, with default header values.
//
// Response with Industry objects
type GetIndustriesOK struct {
	Payload *research_models.IndustryResponse
}

// IsSuccess returns true when this get industries o k response has a 2xx status code
func (o *GetIndustriesOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get industries o k response has a 3xx status code
func (o *GetIndustriesOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get industries o k response has a 4xx status code
func (o *GetIndustriesOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get industries o k response has a 5xx status code
func (o *GetIndustriesOK) IsServerError() bool {
	return false
}

// IsCode returns true when this get industries o k response a status code equal to that given
func (o *GetIndustriesOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the get industries o k response
func (o *GetIndustriesOK) Code() int {
	return 200
}

func (o *GetIndustriesOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesOK %s", 200, payload)
}

func (o *GetIndustriesOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesOK %s", 200, payload)
}

func (o *GetIndustriesOK) GetPayload() *research_models.IndustryResponse {
	return o.Payload
}

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

	o.Payload = new(research_models.IndustryResponse)

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

	return nil
}

// NewGetIndustriesUnauthorized creates a GetIndustriesUnauthorized with default headers values
func NewGetIndustriesUnauthorized() *GetIndustriesUnauthorized {
	return &GetIndustriesUnauthorized{}
}

// GetIndustriesUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
type GetIndustriesUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

// IsSuccess returns true when this get industries unauthorized response has a 2xx status code
func (o *GetIndustriesUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get industries unauthorized response has a 3xx status code
func (o *GetIndustriesUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get industries unauthorized response has a 4xx status code
func (o *GetIndustriesUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this get industries unauthorized response has a 5xx status code
func (o *GetIndustriesUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this get industries unauthorized response a status code equal to that given
func (o *GetIndustriesUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the get industries unauthorized response
func (o *GetIndustriesUnauthorized) Code() int {
	return 401
}

func (o *GetIndustriesUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesUnauthorized %s", 401, payload)
}

func (o *GetIndustriesUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesUnauthorized %s", 401, payload)
}

func (o *GetIndustriesUnauthorized) GetPayload() *research_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(research_models.Error)

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

	return nil
}

// NewGetIndustriesForbidden creates a GetIndustriesForbidden with default headers values
func NewGetIndustriesForbidden() *GetIndustriesForbidden {
	return &GetIndustriesForbidden{}
}

// GetIndustriesForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type GetIndustriesForbidden struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

// IsSuccess returns true when this get industries forbidden response has a 2xx status code
func (o *GetIndustriesForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get industries forbidden response has a 3xx status code
func (o *GetIndustriesForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get industries forbidden response has a 4xx status code
func (o *GetIndustriesForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this get industries forbidden response has a 5xx status code
func (o *GetIndustriesForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this get industries forbidden response a status code equal to that given
func (o *GetIndustriesForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the get industries forbidden response
func (o *GetIndustriesForbidden) Code() int {
	return 403
}

func (o *GetIndustriesForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesForbidden %s", 403, payload)
}

func (o *GetIndustriesForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesForbidden %s", 403, payload)
}

func (o *GetIndustriesForbidden) GetPayload() *research_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(research_models.Error)

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

	return nil
}

// NewGetIndustriesNotFound creates a GetIndustriesNotFound with default headers values
func NewGetIndustriesNotFound() *GetIndustriesNotFound {
	return &GetIndustriesNotFound{}
}

// GetIndustriesNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type GetIndustriesNotFound struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

// IsSuccess returns true when this get industries not found response has a 2xx status code
func (o *GetIndustriesNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get industries not found response has a 3xx status code
func (o *GetIndustriesNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get industries not found response has a 4xx status code
func (o *GetIndustriesNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this get industries not found response has a 5xx status code
func (o *GetIndustriesNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this get industries not found response a status code equal to that given
func (o *GetIndustriesNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the get industries not found response
func (o *GetIndustriesNotFound) Code() int {
	return 404
}

func (o *GetIndustriesNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesNotFound %s", 404, payload)
}

func (o *GetIndustriesNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesNotFound %s", 404, payload)
}

func (o *GetIndustriesNotFound) GetPayload() *research_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(research_models.Error)

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

	return nil
}

// NewGetIndustriesUnprocessableEntity creates a GetIndustriesUnprocessableEntity with default headers values
func NewGetIndustriesUnprocessableEntity() *GetIndustriesUnprocessableEntity {
	return &GetIndustriesUnprocessableEntity{}
}

// GetIndustriesUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type GetIndustriesUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

// IsSuccess returns true when this get industries unprocessable entity response has a 2xx status code
func (o *GetIndustriesUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get industries unprocessable entity response has a 3xx status code
func (o *GetIndustriesUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get industries unprocessable entity response has a 4xx status code
func (o *GetIndustriesUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this get industries unprocessable entity response has a 5xx status code
func (o *GetIndustriesUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this get industries unprocessable entity response a status code equal to that given
func (o *GetIndustriesUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the get industries unprocessable entity response
func (o *GetIndustriesUnprocessableEntity) Code() int {
	return 422
}

func (o *GetIndustriesUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesUnprocessableEntity %s", 422, payload)
}

func (o *GetIndustriesUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesUnprocessableEntity %s", 422, payload)
}

func (o *GetIndustriesUnprocessableEntity) GetPayload() *research_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(research_models.Error)

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

	return nil
}

// NewGetIndustriesInternalServerError creates a GetIndustriesInternalServerError with default headers values
func NewGetIndustriesInternalServerError() *GetIndustriesInternalServerError {
	return &GetIndustriesInternalServerError{}
}

// GetIndustriesInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type GetIndustriesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

// IsSuccess returns true when this get industries internal server error response has a 2xx status code
func (o *GetIndustriesInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get industries internal server error response has a 3xx status code
func (o *GetIndustriesInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get industries internal server error response has a 4xx status code
func (o *GetIndustriesInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this get industries internal server error response has a 5xx status code
func (o *GetIndustriesInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this get industries internal server error response a status code equal to that given
func (o *GetIndustriesInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the get industries internal server error response
func (o *GetIndustriesInternalServerError) Code() int {
	return 500
}

func (o *GetIndustriesInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesInternalServerError %s", 500, payload)
}

func (o *GetIndustriesInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /industries][%d] getIndustriesInternalServerError %s", 500, payload)
}

func (o *GetIndustriesInternalServerError) GetPayload() *research_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(research_models.Error)

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

	return nil
}
