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

// ReviewCompanyProductProposalReader is a Reader for the ReviewCompanyProductProposal structure.
type ReviewCompanyProductProposalReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ReviewCompanyProductProposalReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewReviewCompanyProductProposalOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewReviewCompanyProductProposalUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewReviewCompanyProductProposalForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewReviewCompanyProductProposalNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewReviewCompanyProductProposalConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewReviewCompanyProductProposalUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewReviewCompanyProductProposalInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /companyproductproposals/{companyProductProposalId}/review] reviewCompanyProductProposal", response, response.Code())
	}
}

// NewReviewCompanyProductProposalOK creates a ReviewCompanyProductProposalOK with default headers values
func NewReviewCompanyProductProposalOK() *ReviewCompanyProductProposalOK {
	return &ReviewCompanyProductProposalOK{}
}

// ReviewCompanyProductProposalOK describes a response with status code 200, with default header values.
//
// Proposal review completed
type ReviewCompanyProductProposalOK struct {
	Payload *research_models.CompanyProductProposal
}

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

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

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

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

// IsCode returns true when this review company product proposal o k response a status code equal to that given
func (o *ReviewCompanyProductProposalOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the review company product proposal o k response
func (o *ReviewCompanyProductProposalOK) Code() int {
	return 200
}

func (o *ReviewCompanyProductProposalOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /companyproductproposals/{companyProductProposalId}/review][%d] reviewCompanyProductProposalOK %s", 200, payload)
}

func (o *ReviewCompanyProductProposalOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /companyproductproposals/{companyProductProposalId}/review][%d] reviewCompanyProductProposalOK %s", 200, payload)
}

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

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

// NewReviewCompanyProductProposalUnauthorized creates a ReviewCompanyProductProposalUnauthorized with default headers values
func NewReviewCompanyProductProposalUnauthorized() *ReviewCompanyProductProposalUnauthorized {
	return &ReviewCompanyProductProposalUnauthorized{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewReviewCompanyProductProposalForbidden creates a ReviewCompanyProductProposalForbidden with default headers values
func NewReviewCompanyProductProposalForbidden() *ReviewCompanyProductProposalForbidden {
	return &ReviewCompanyProductProposalForbidden{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewReviewCompanyProductProposalNotFound creates a ReviewCompanyProductProposalNotFound with default headers values
func NewReviewCompanyProductProposalNotFound() *ReviewCompanyProductProposalNotFound {
	return &ReviewCompanyProductProposalNotFound{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewReviewCompanyProductProposalConflict creates a ReviewCompanyProductProposalConflict with default headers values
func NewReviewCompanyProductProposalConflict() *ReviewCompanyProductProposalConflict {
	return &ReviewCompanyProductProposalConflict{}
}

// ReviewCompanyProductProposalConflict describes a response with status code 409, with default header values.
//
// Proposal state or optimistic version conflict
type ReviewCompanyProductProposalConflict struct {
	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewReviewCompanyProductProposalUnprocessableEntity creates a ReviewCompanyProductProposalUnprocessableEntity with default headers values
func NewReviewCompanyProductProposalUnprocessableEntity() *ReviewCompanyProductProposalUnprocessableEntity {
	return &ReviewCompanyProductProposalUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewReviewCompanyProductProposalInternalServerError creates a ReviewCompanyProductProposalInternalServerError with default headers values
func NewReviewCompanyProductProposalInternalServerError() *ReviewCompanyProductProposalInternalServerError {
	return &ReviewCompanyProductProposalInternalServerError{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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