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

// SubmitCompanyProductProposalReader is a Reader for the SubmitCompanyProductProposal structure.
type SubmitCompanyProductProposalReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *SubmitCompanyProductProposalReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewSubmitCompanyProductProposalOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewSubmitCompanyProductProposalUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewSubmitCompanyProductProposalForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewSubmitCompanyProductProposalNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewSubmitCompanyProductProposalConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewSubmitCompanyProductProposalUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewSubmitCompanyProductProposalInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /companyproductproposals/{companyProductProposalId}/submit] submitCompanyProductProposal", response, response.Code())
	}
}

// NewSubmitCompanyProductProposalOK creates a SubmitCompanyProductProposalOK with default headers values
func NewSubmitCompanyProductProposalOK() *SubmitCompanyProductProposalOK {
	return &SubmitCompanyProductProposalOK{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewSubmitCompanyProductProposalUnauthorized creates a SubmitCompanyProductProposalUnauthorized with default headers values
func NewSubmitCompanyProductProposalUnauthorized() *SubmitCompanyProductProposalUnauthorized {
	return &SubmitCompanyProductProposalUnauthorized{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewSubmitCompanyProductProposalForbidden creates a SubmitCompanyProductProposalForbidden with default headers values
func NewSubmitCompanyProductProposalForbidden() *SubmitCompanyProductProposalForbidden {
	return &SubmitCompanyProductProposalForbidden{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewSubmitCompanyProductProposalNotFound creates a SubmitCompanyProductProposalNotFound with default headers values
func NewSubmitCompanyProductProposalNotFound() *SubmitCompanyProductProposalNotFound {
	return &SubmitCompanyProductProposalNotFound{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewSubmitCompanyProductProposalConflict creates a SubmitCompanyProductProposalConflict with default headers values
func NewSubmitCompanyProductProposalConflict() *SubmitCompanyProductProposalConflict {
	return &SubmitCompanyProductProposalConflict{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewSubmitCompanyProductProposalUnprocessableEntity creates a SubmitCompanyProductProposalUnprocessableEntity with default headers values
func NewSubmitCompanyProductProposalUnprocessableEntity() *SubmitCompanyProductProposalUnprocessableEntity {
	return &SubmitCompanyProductProposalUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewSubmitCompanyProductProposalInternalServerError creates a SubmitCompanyProductProposalInternalServerError with default headers values
func NewSubmitCompanyProductProposalInternalServerError() *SubmitCompanyProductProposalInternalServerError {
	return &SubmitCompanyProductProposalInternalServerError{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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