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

// GetCompanyProductProposalsReader is a Reader for the GetCompanyProductProposals structure.
type GetCompanyProductProposalsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetCompanyProductProposalsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetCompanyProductProposalsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetCompanyProductProposalsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetCompanyProductProposalsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetCompanyProductProposalsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetCompanyProductProposalsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /companyproductproposals] getCompanyProductProposals", response, response.Code())
	}
}

// NewGetCompanyProductProposalsOK creates a GetCompanyProductProposalsOK with default headers values
func NewGetCompanyProductProposalsOK() *GetCompanyProductProposalsOK {
	return &GetCompanyProductProposalsOK{}
}

// GetCompanyProductProposalsOK describes a response with status code 200, with default header values.
//
// Governed proposal collection
type GetCompanyProductProposalsOK struct {
	Payload *research_models.CompanyProductProposalResponse
}

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

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

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

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

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

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

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

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

func (o *GetCompanyProductProposalsOK) GetPayload() *research_models.CompanyProductProposalResponse {
	return o.Payload
}

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

	o.Payload = new(research_models.CompanyProductProposalResponse)

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

	return nil
}

// NewGetCompanyProductProposalsUnauthorized creates a GetCompanyProductProposalsUnauthorized with default headers values
func NewGetCompanyProductProposalsUnauthorized() *GetCompanyProductProposalsUnauthorized {
	return &GetCompanyProductProposalsUnauthorized{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetCompanyProductProposalsForbidden creates a GetCompanyProductProposalsForbidden with default headers values
func NewGetCompanyProductProposalsForbidden() *GetCompanyProductProposalsForbidden {
	return &GetCompanyProductProposalsForbidden{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetCompanyProductProposalsUnprocessableEntity creates a GetCompanyProductProposalsUnprocessableEntity with default headers values
func NewGetCompanyProductProposalsUnprocessableEntity() *GetCompanyProductProposalsUnprocessableEntity {
	return &GetCompanyProductProposalsUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

// Code gets the status code for the get company product proposals unprocessable entity response
func (o *GetCompanyProductProposalsUnprocessableEntity) Code() int {
	return 422
}

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

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

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

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

// NewGetCompanyProductProposalsInternalServerError creates a GetCompanyProductProposalsInternalServerError with default headers values
func NewGetCompanyProductProposalsInternalServerError() *GetCompanyProductProposalsInternalServerError {
	return &GetCompanyProductProposalsInternalServerError{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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