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

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

// PostCompanyProductProposalReader is a Reader for the PostCompanyProductProposal structure.
type PostCompanyProductProposalReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCompanyProductProposalReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 201:
		result := NewPostCompanyProductProposalCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostCompanyProductProposalBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostCompanyProductProposalUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostCompanyProductProposalForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostCompanyProductProposalNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPostCompanyProductProposalConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostCompanyProductProposalUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostCompanyProductProposalInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /companyproductproposals] postCompanyProductProposal", response, response.Code())
	}
}

// NewPostCompanyProductProposalCreated creates a PostCompanyProductProposalCreated with default headers values
func NewPostCompanyProductProposalCreated() *PostCompanyProductProposalCreated {
	return &PostCompanyProductProposalCreated{}
}

// PostCompanyProductProposalCreated describes a response with status code 201, with default header values.
//
// Draft proposal created
type PostCompanyProductProposalCreated struct {
	Payload *research_models.CompanyProductProposal
}

// IsSuccess returns true when this post company product proposal created response has a 2xx status code
func (o *PostCompanyProductProposalCreated) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this post company product proposal created response has a 3xx status code
func (o *PostCompanyProductProposalCreated) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post company product proposal created response has a 4xx status code
func (o *PostCompanyProductProposalCreated) IsClientError() bool {
	return false
}

// IsServerError returns true when this post company product proposal created response has a 5xx status code
func (o *PostCompanyProductProposalCreated) IsServerError() bool {
	return false
}

// IsCode returns true when this post company product proposal created response a status code equal to that given
func (o *PostCompanyProductProposalCreated) IsCode(code int) bool {
	return code == 201
}

// Code gets the status code for the post company product proposal created response
func (o *PostCompanyProductProposalCreated) Code() int {
	return 201
}

func (o *PostCompanyProductProposalCreated) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /companyproductproposals][%d] postCompanyProductProposalCreated %s", 201, payload)
}

func (o *PostCompanyProductProposalCreated) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /companyproductproposals][%d] postCompanyProductProposalCreated %s", 201, payload)
}

func (o *PostCompanyProductProposalCreated) GetPayload() *research_models.CompanyProductProposal {
	return o.Payload
}

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

	o.Payload = new(research_models.CompanyProductProposal)

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

	return nil
}

// NewPostCompanyProductProposalBadRequest creates a PostCompanyProductProposalBadRequest with default headers values
func NewPostCompanyProductProposalBadRequest() *PostCompanyProductProposalBadRequest {
	return &PostCompanyProductProposalBadRequest{}
}

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

	Payload *research_models.Error
}

// IsSuccess returns true when this post company product proposal bad request response has a 2xx status code
func (o *PostCompanyProductProposalBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post company product proposal bad request response has a 3xx status code
func (o *PostCompanyProductProposalBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post company product proposal bad request response has a 4xx status code
func (o *PostCompanyProductProposalBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this post company product proposal bad request response has a 5xx status code
func (o *PostCompanyProductProposalBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this post company product proposal bad request response a status code equal to that given
func (o *PostCompanyProductProposalBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the post company product proposal bad request response
func (o *PostCompanyProductProposalBadRequest) Code() int {
	return 400
}

func (o *PostCompanyProductProposalBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /companyproductproposals][%d] postCompanyProductProposalBadRequest %s", 400, payload)
}

func (o *PostCompanyProductProposalBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /companyproductproposals][%d] postCompanyProductProposalBadRequest %s", 400, payload)
}

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

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

// NewPostCompanyProductProposalUnauthorized creates a PostCompanyProductProposalUnauthorized with default headers values
func NewPostCompanyProductProposalUnauthorized() *PostCompanyProductProposalUnauthorized {
	return &PostCompanyProductProposalUnauthorized{}
}

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

	Payload *research_models.Error
}

// IsSuccess returns true when this post company product proposal unauthorized response has a 2xx status code
func (o *PostCompanyProductProposalUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post company product proposal unauthorized response has a 3xx status code
func (o *PostCompanyProductProposalUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post company product proposal unauthorized response has a 4xx status code
func (o *PostCompanyProductProposalUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this post company product proposal unauthorized response has a 5xx status code
func (o *PostCompanyProductProposalUnauthorized) IsServerError() bool {
	return false
}

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

// Code gets the status code for the post company product proposal unauthorized response
func (o *PostCompanyProductProposalUnauthorized) Code() int {
	return 401
}

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

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

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

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

// NewPostCompanyProductProposalForbidden creates a PostCompanyProductProposalForbidden with default headers values
func NewPostCompanyProductProposalForbidden() *PostCompanyProductProposalForbidden {
	return &PostCompanyProductProposalForbidden{}
}

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

	Payload *research_models.Error
}

// IsSuccess returns true when this post company product proposal forbidden response has a 2xx status code
func (o *PostCompanyProductProposalForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post company product proposal forbidden response has a 3xx status code
func (o *PostCompanyProductProposalForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post company product proposal forbidden response has a 4xx status code
func (o *PostCompanyProductProposalForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this post company product proposal forbidden response has a 5xx status code
func (o *PostCompanyProductProposalForbidden) IsServerError() bool {
	return false
}

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

// Code gets the status code for the post company product proposal forbidden response
func (o *PostCompanyProductProposalForbidden) Code() int {
	return 403
}

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

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

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

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

// NewPostCompanyProductProposalNotFound creates a PostCompanyProductProposalNotFound with default headers values
func NewPostCompanyProductProposalNotFound() *PostCompanyProductProposalNotFound {
	return &PostCompanyProductProposalNotFound{}
}

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

	Payload *research_models.Error
}

// IsSuccess returns true when this post company product proposal not found response has a 2xx status code
func (o *PostCompanyProductProposalNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post company product proposal not found response has a 3xx status code
func (o *PostCompanyProductProposalNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post company product proposal not found response has a 4xx status code
func (o *PostCompanyProductProposalNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this post company product proposal not found response has a 5xx status code
func (o *PostCompanyProductProposalNotFound) IsServerError() bool {
	return false
}

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

// Code gets the status code for the post company product proposal not found response
func (o *PostCompanyProductProposalNotFound) Code() int {
	return 404
}

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

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

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

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

// NewPostCompanyProductProposalConflict creates a PostCompanyProductProposalConflict with default headers values
func NewPostCompanyProductProposalConflict() *PostCompanyProductProposalConflict {
	return &PostCompanyProductProposalConflict{}
}

// PostCompanyProductProposalConflict describes a response with status code 409, with default header values.
//
// Product version or idempotency conflict
type PostCompanyProductProposalConflict struct {
	Payload *research_models.Error
}

// IsSuccess returns true when this post company product proposal conflict response has a 2xx status code
func (o *PostCompanyProductProposalConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post company product proposal conflict response has a 3xx status code
func (o *PostCompanyProductProposalConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post company product proposal conflict response has a 4xx status code
func (o *PostCompanyProductProposalConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this post company product proposal conflict response has a 5xx status code
func (o *PostCompanyProductProposalConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this post company product proposal conflict response a status code equal to that given
func (o *PostCompanyProductProposalConflict) IsCode(code int) bool {
	return code == 409
}

// Code gets the status code for the post company product proposal conflict response
func (o *PostCompanyProductProposalConflict) Code() int {
	return 409
}

func (o *PostCompanyProductProposalConflict) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /companyproductproposals][%d] postCompanyProductProposalConflict %s", 409, payload)
}

func (o *PostCompanyProductProposalConflict) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /companyproductproposals][%d] postCompanyProductProposalConflict %s", 409, payload)
}

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

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

	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
}

// NewPostCompanyProductProposalUnprocessableEntity creates a PostCompanyProductProposalUnprocessableEntity with default headers values
func NewPostCompanyProductProposalUnprocessableEntity() *PostCompanyProductProposalUnprocessableEntity {
	return &PostCompanyProductProposalUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

// IsSuccess returns true when this post company product proposal unprocessable entity response has a 2xx status code
func (o *PostCompanyProductProposalUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post company product proposal unprocessable entity response has a 3xx status code
func (o *PostCompanyProductProposalUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post company product proposal unprocessable entity response has a 4xx status code
func (o *PostCompanyProductProposalUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this post company product proposal unprocessable entity response has a 5xx status code
func (o *PostCompanyProductProposalUnprocessableEntity) IsServerError() bool {
	return false
}

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

// Code gets the status code for the post company product proposal unprocessable entity response
func (o *PostCompanyProductProposalUnprocessableEntity) Code() int {
	return 422
}

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

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

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

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

// NewPostCompanyProductProposalInternalServerError creates a PostCompanyProductProposalInternalServerError with default headers values
func NewPostCompanyProductProposalInternalServerError() *PostCompanyProductProposalInternalServerError {
	return &PostCompanyProductProposalInternalServerError{}
}

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

	Payload *research_models.Error
}

// IsSuccess returns true when this post company product proposal internal server error response has a 2xx status code
func (o *PostCompanyProductProposalInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post company product proposal internal server error response has a 3xx status code
func (o *PostCompanyProductProposalInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post company product proposal internal server error response has a 4xx status code
func (o *PostCompanyProductProposalInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this post company product proposal internal server error response has a 5xx status code
func (o *PostCompanyProductProposalInternalServerError) IsServerError() bool {
	return true
}

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

// Code gets the status code for the post company product proposal internal server error response
func (o *PostCompanyProductProposalInternalServerError) Code() int {
	return 500
}

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

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

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

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