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

// PutIndustriesReader is a Reader for the PutIndustries structure.
type PutIndustriesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutIndustriesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutIndustriesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutIndustriesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutIndustriesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutIndustriesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPutIndustriesConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutIndustriesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutIndustriesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /industries] putIndustries", response, response.Code())
	}
}

// NewPutIndustriesOK creates a PutIndustriesOK with default headers values
func NewPutIndustriesOK() *PutIndustriesOK {
	return &PutIndustriesOK{}
}

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

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

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

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

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

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

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

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

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

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

func (o *PutIndustriesOK) 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
}

// NewPutIndustriesUnauthorized creates a PutIndustriesUnauthorized with default headers values
func NewPutIndustriesUnauthorized() *PutIndustriesUnauthorized {
	return &PutIndustriesUnauthorized{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

func (o *PutIndustriesUnauthorized) 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
}

// NewPutIndustriesForbidden creates a PutIndustriesForbidden with default headers values
func NewPutIndustriesForbidden() *PutIndustriesForbidden {
	return &PutIndustriesForbidden{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

func (o *PutIndustriesForbidden) 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
}

// NewPutIndustriesNotFound creates a PutIndustriesNotFound with default headers values
func NewPutIndustriesNotFound() *PutIndustriesNotFound {
	return &PutIndustriesNotFound{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

func (o *PutIndustriesNotFound) 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
}

// NewPutIndustriesConflict creates a PutIndustriesConflict with default headers values
func NewPutIndustriesConflict() *PutIndustriesConflict {
	return &PutIndustriesConflict{}
}

// PutIndustriesConflict describes a response with status code 409, with default header values.
//
// Conflict
type PutIndustriesConflict struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

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

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

// IsClientError returns true when this put industries conflict response has a 4xx status code
func (o *PutIndustriesConflict) IsClientError() bool {
	return true
}

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

// IsCode returns true when this put industries conflict response a status code equal to that given
func (o *PutIndustriesConflict) IsCode(code int) bool {
	return code == 409
}

// Code gets the status code for the put industries conflict response
func (o *PutIndustriesConflict) Code() int {
	return 409
}

func (o *PutIndustriesConflict) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /industries][%d] putIndustriesConflict %s", 409, payload)
}

func (o *PutIndustriesConflict) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /industries][%d] putIndustriesConflict %s", 409, payload)
}

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

func (o *PutIndustriesConflict) 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
}

// NewPutIndustriesUnprocessableEntity creates a PutIndustriesUnprocessableEntity with default headers values
func NewPutIndustriesUnprocessableEntity() *PutIndustriesUnprocessableEntity {
	return &PutIndustriesUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

func (o *PutIndustriesUnprocessableEntity) 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
}

// NewPutIndustriesInternalServerError creates a PutIndustriesInternalServerError with default headers values
func NewPutIndustriesInternalServerError() *PutIndustriesInternalServerError {
	return &PutIndustriesInternalServerError{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

func (o *PutIndustriesInternalServerError) 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
}
