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

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

// PostIndustryCompaniesReader is a Reader for the PostIndustryCompanies structure.
type PostIndustryCompaniesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostIndustryCompaniesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostIndustryCompaniesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostIndustryCompaniesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostIndustryCompaniesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostIndustryCompaniesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostIndustryCompaniesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostIndustryCompaniesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /industrycompanies] postIndustryCompanies", response, response.Code())
	}
}

// NewPostIndustryCompaniesOK creates a PostIndustryCompaniesOK with default headers values
func NewPostIndustryCompaniesOK() *PostIndustryCompaniesOK {
	return &PostIndustryCompaniesOK{}
}

// PostIndustryCompaniesOK describes a response with status code 200, with default header values.
//
// Response with IndustryCompany objects
type PostIndustryCompaniesOK struct {
	Payload *research_models.IndustryCompanyResponse
}

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

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

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

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

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

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

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

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

func (o *PostIndustryCompaniesOK) GetPayload() *research_models.IndustryCompanyResponse {
	return o.Payload
}

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

	o.Payload = new(research_models.IndustryCompanyResponse)

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

	return nil
}

// NewPostIndustryCompaniesUnauthorized creates a PostIndustryCompaniesUnauthorized with default headers values
func NewPostIndustryCompaniesUnauthorized() *PostIndustryCompaniesUnauthorized {
	return &PostIndustryCompaniesUnauthorized{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostIndustryCompaniesForbidden creates a PostIndustryCompaniesForbidden with default headers values
func NewPostIndustryCompaniesForbidden() *PostIndustryCompaniesForbidden {
	return &PostIndustryCompaniesForbidden{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostIndustryCompaniesNotFound creates a PostIndustryCompaniesNotFound with default headers values
func NewPostIndustryCompaniesNotFound() *PostIndustryCompaniesNotFound {
	return &PostIndustryCompaniesNotFound{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostIndustryCompaniesUnprocessableEntity creates a PostIndustryCompaniesUnprocessableEntity with default headers values
func NewPostIndustryCompaniesUnprocessableEntity() *PostIndustryCompaniesUnprocessableEntity {
	return &PostIndustryCompaniesUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostIndustryCompaniesInternalServerError creates a PostIndustryCompaniesInternalServerError with default headers values
func NewPostIndustryCompaniesInternalServerError() *PostIndustryCompaniesInternalServerError {
	return &PostIndustryCompaniesInternalServerError{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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