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

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

// PostIndustryProductsReader is a Reader for the PostIndustryProducts structure.
type PostIndustryProductsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostIndustryProductsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostIndustryProductsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostIndustryProductsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostIndustryProductsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostIndustryProductsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostIndustryProductsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostIndustryProductsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /industryproducts] postIndustryProducts", response, response.Code())
	}
}

// NewPostIndustryProductsOK creates a PostIndustryProductsOK with default headers values
func NewPostIndustryProductsOK() *PostIndustryProductsOK {
	return &PostIndustryProductsOK{}
}

// PostIndustryProductsOK describes a response with status code 200, with default header values.
//
// Response with IndustryProduct objects
type PostIndustryProductsOK struct {
	Payload *research_models.IndustryProductResponse
}

// IsSuccess returns true when this post industry products o k response has a 2xx status code
func (o *PostIndustryProductsOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this post industry products o k response has a 3xx status code
func (o *PostIndustryProductsOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post industry products o k response has a 4xx status code
func (o *PostIndustryProductsOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this post industry products o k response has a 5xx status code
func (o *PostIndustryProductsOK) IsServerError() bool {
	return false
}

// IsCode returns true when this post industry products o k response a status code equal to that given
func (o *PostIndustryProductsOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the post industry products o k response
func (o *PostIndustryProductsOK) Code() int {
	return 200
}

func (o *PostIndustryProductsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsOK %s", 200, payload)
}

func (o *PostIndustryProductsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsOK %s", 200, payload)
}

func (o *PostIndustryProductsOK) GetPayload() *research_models.IndustryProductResponse {
	return o.Payload
}

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

	o.Payload = new(research_models.IndustryProductResponse)

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

	return nil
}

// NewPostIndustryProductsUnauthorized creates a PostIndustryProductsUnauthorized with default headers values
func NewPostIndustryProductsUnauthorized() *PostIndustryProductsUnauthorized {
	return &PostIndustryProductsUnauthorized{}
}

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

	Payload *research_models.Error
}

// IsSuccess returns true when this post industry products unauthorized response has a 2xx status code
func (o *PostIndustryProductsUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post industry products unauthorized response has a 3xx status code
func (o *PostIndustryProductsUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post industry products unauthorized response has a 4xx status code
func (o *PostIndustryProductsUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this post industry products unauthorized response has a 5xx status code
func (o *PostIndustryProductsUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this post industry products unauthorized response a status code equal to that given
func (o *PostIndustryProductsUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the post industry products unauthorized response
func (o *PostIndustryProductsUnauthorized) Code() int {
	return 401
}

func (o *PostIndustryProductsUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsUnauthorized %s", 401, payload)
}

func (o *PostIndustryProductsUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsUnauthorized %s", 401, payload)
}

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

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

// NewPostIndustryProductsForbidden creates a PostIndustryProductsForbidden with default headers values
func NewPostIndustryProductsForbidden() *PostIndustryProductsForbidden {
	return &PostIndustryProductsForbidden{}
}

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

	Payload *research_models.Error
}

// IsSuccess returns true when this post industry products forbidden response has a 2xx status code
func (o *PostIndustryProductsForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post industry products forbidden response has a 3xx status code
func (o *PostIndustryProductsForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post industry products forbidden response has a 4xx status code
func (o *PostIndustryProductsForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this post industry products forbidden response has a 5xx status code
func (o *PostIndustryProductsForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this post industry products forbidden response a status code equal to that given
func (o *PostIndustryProductsForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the post industry products forbidden response
func (o *PostIndustryProductsForbidden) Code() int {
	return 403
}

func (o *PostIndustryProductsForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsForbidden %s", 403, payload)
}

func (o *PostIndustryProductsForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsForbidden %s", 403, payload)
}

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

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

// NewPostIndustryProductsNotFound creates a PostIndustryProductsNotFound with default headers values
func NewPostIndustryProductsNotFound() *PostIndustryProductsNotFound {
	return &PostIndustryProductsNotFound{}
}

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

	Payload *research_models.Error
}

// IsSuccess returns true when this post industry products not found response has a 2xx status code
func (o *PostIndustryProductsNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post industry products not found response has a 3xx status code
func (o *PostIndustryProductsNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post industry products not found response has a 4xx status code
func (o *PostIndustryProductsNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this post industry products not found response has a 5xx status code
func (o *PostIndustryProductsNotFound) IsServerError() bool {
	return false
}

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

// Code gets the status code for the post industry products not found response
func (o *PostIndustryProductsNotFound) Code() int {
	return 404
}

func (o *PostIndustryProductsNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsNotFound %s", 404, payload)
}

func (o *PostIndustryProductsNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsNotFound %s", 404, payload)
}

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

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

// NewPostIndustryProductsUnprocessableEntity creates a PostIndustryProductsUnprocessableEntity with default headers values
func NewPostIndustryProductsUnprocessableEntity() *PostIndustryProductsUnprocessableEntity {
	return &PostIndustryProductsUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

// IsSuccess returns true when this post industry products unprocessable entity response has a 2xx status code
func (o *PostIndustryProductsUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post industry products unprocessable entity response has a 3xx status code
func (o *PostIndustryProductsUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post industry products unprocessable entity response has a 4xx status code
func (o *PostIndustryProductsUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this post industry products unprocessable entity response has a 5xx status code
func (o *PostIndustryProductsUnprocessableEntity) IsServerError() bool {
	return false
}

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

// Code gets the status code for the post industry products unprocessable entity response
func (o *PostIndustryProductsUnprocessableEntity) Code() int {
	return 422
}

func (o *PostIndustryProductsUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsUnprocessableEntity %s", 422, payload)
}

func (o *PostIndustryProductsUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsUnprocessableEntity %s", 422, payload)
}

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

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

// NewPostIndustryProductsInternalServerError creates a PostIndustryProductsInternalServerError with default headers values
func NewPostIndustryProductsInternalServerError() *PostIndustryProductsInternalServerError {
	return &PostIndustryProductsInternalServerError{}
}

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

	Payload *research_models.Error
}

// IsSuccess returns true when this post industry products internal server error response has a 2xx status code
func (o *PostIndustryProductsInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post industry products internal server error response has a 3xx status code
func (o *PostIndustryProductsInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post industry products internal server error response has a 4xx status code
func (o *PostIndustryProductsInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this post industry products internal server error response has a 5xx status code
func (o *PostIndustryProductsInternalServerError) IsServerError() bool {
	return true
}

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

// Code gets the status code for the post industry products internal server error response
func (o *PostIndustryProductsInternalServerError) Code() int {
	return 500
}

func (o *PostIndustryProductsInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsInternalServerError %s", 500, payload)
}

func (o *PostIndustryProductsInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /industryproducts][%d] postIndustryProductsInternalServerError %s", 500, payload)
}

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

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