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

// GetCompanyProductProposalReader is a Reader for the GetCompanyProductProposal structure.
type GetCompanyProductProposalReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetCompanyProductProposalReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetCompanyProductProposalOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetCompanyProductProposalUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetCompanyProductProposalForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetCompanyProductProposalNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetCompanyProductProposalInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /companyproductproposals/{companyProductProposalId}] getCompanyProductProposal", response, response.Code())
	}
}

// NewGetCompanyProductProposalOK creates a GetCompanyProductProposalOK with default headers values
func NewGetCompanyProductProposalOK() *GetCompanyProductProposalOK {
	return &GetCompanyProductProposalOK{}
}

// GetCompanyProductProposalOK describes a response with status code 200, with default header values.
//
// Governed proposal detail
type GetCompanyProductProposalOK struct {
	Payload *research_models.CompanyProductProposal
}

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

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

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

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

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

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

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

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

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

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

// NewGetCompanyProductProposalUnauthorized creates a GetCompanyProductProposalUnauthorized with default headers values
func NewGetCompanyProductProposalUnauthorized() *GetCompanyProductProposalUnauthorized {
	return &GetCompanyProductProposalUnauthorized{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetCompanyProductProposalForbidden creates a GetCompanyProductProposalForbidden with default headers values
func NewGetCompanyProductProposalForbidden() *GetCompanyProductProposalForbidden {
	return &GetCompanyProductProposalForbidden{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetCompanyProductProposalNotFound creates a GetCompanyProductProposalNotFound with default headers values
func NewGetCompanyProductProposalNotFound() *GetCompanyProductProposalNotFound {
	return &GetCompanyProductProposalNotFound{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetCompanyProductProposalInternalServerError creates a GetCompanyProductProposalInternalServerError with default headers values
func NewGetCompanyProductProposalInternalServerError() *GetCompanyProductProposalInternalServerError {
	return &GetCompanyProductProposalInternalServerError{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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