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

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// GetResearchProjectCompaniesReader is a Reader for the GetResearchProjectCompanies structure.
type GetResearchProjectCompaniesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetResearchProjectCompaniesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetResearchProjectCompaniesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetResearchProjectCompaniesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetResearchProjectCompaniesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetResearchProjectCompaniesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetResearchProjectCompaniesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetResearchProjectCompaniesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /researchprojectcompanies] getResearchProjectCompanies", response, response.Code())
	}
}

// NewGetResearchProjectCompaniesOK creates a GetResearchProjectCompaniesOK with default headers values
func NewGetResearchProjectCompaniesOK() *GetResearchProjectCompaniesOK {
	return &GetResearchProjectCompaniesOK{}
}

// GetResearchProjectCompaniesOK describes a response with status code 200, with default header values.
//
// ResearchProjectCompany Response Object
type GetResearchProjectCompaniesOK struct {
	Payload *members_models.ResearchProjectCompanyResponse
}

// IsSuccess returns true when this get research project companies o k response has a 2xx status code
func (o *GetResearchProjectCompaniesOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get research project companies o k response has a 3xx status code
func (o *GetResearchProjectCompaniesOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get research project companies o k response has a 4xx status code
func (o *GetResearchProjectCompaniesOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get research project companies o k response has a 5xx status code
func (o *GetResearchProjectCompaniesOK) IsServerError() bool {
	return false
}

// IsCode returns true when this get research project companies o k response a status code equal to that given
func (o *GetResearchProjectCompaniesOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the get research project companies o k response
func (o *GetResearchProjectCompaniesOK) Code() int {
	return 200
}

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

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

func (o *GetResearchProjectCompaniesOK) GetPayload() *members_models.ResearchProjectCompanyResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.ResearchProjectCompanyResponse)

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

	return nil
}

// NewGetResearchProjectCompaniesUnauthorized creates a GetResearchProjectCompaniesUnauthorized with default headers values
func NewGetResearchProjectCompaniesUnauthorized() *GetResearchProjectCompaniesUnauthorized {
	return &GetResearchProjectCompaniesUnauthorized{}
}

// GetResearchProjectCompaniesUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
type GetResearchProjectCompaniesUnauthorized struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this get research project companies unauthorized response has a 2xx status code
func (o *GetResearchProjectCompaniesUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get research project companies unauthorized response has a 3xx status code
func (o *GetResearchProjectCompaniesUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get research project companies unauthorized response has a 4xx status code
func (o *GetResearchProjectCompaniesUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this get research project companies unauthorized response has a 5xx status code
func (o *GetResearchProjectCompaniesUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this get research project companies unauthorized response a status code equal to that given
func (o *GetResearchProjectCompaniesUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the get research project companies unauthorized response
func (o *GetResearchProjectCompaniesUnauthorized) Code() int {
	return 401
}

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

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

func (o *GetResearchProjectCompaniesUnauthorized) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewGetResearchProjectCompaniesForbidden creates a GetResearchProjectCompaniesForbidden with default headers values
func NewGetResearchProjectCompaniesForbidden() *GetResearchProjectCompaniesForbidden {
	return &GetResearchProjectCompaniesForbidden{}
}

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

	Payload *members_models.Error
}

// IsSuccess returns true when this get research project companies forbidden response has a 2xx status code
func (o *GetResearchProjectCompaniesForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get research project companies forbidden response has a 3xx status code
func (o *GetResearchProjectCompaniesForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get research project companies forbidden response has a 4xx status code
func (o *GetResearchProjectCompaniesForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this get research project companies forbidden response has a 5xx status code
func (o *GetResearchProjectCompaniesForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this get research project companies forbidden response a status code equal to that given
func (o *GetResearchProjectCompaniesForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the get research project companies forbidden response
func (o *GetResearchProjectCompaniesForbidden) Code() int {
	return 403
}

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

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

func (o *GetResearchProjectCompaniesForbidden) GetPayload() *members_models.Error {
	return o.Payload
}

func (o *GetResearchProjectCompaniesForbidden) 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(members_models.Error)

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

	return nil
}

// NewGetResearchProjectCompaniesNotFound creates a GetResearchProjectCompaniesNotFound with default headers values
func NewGetResearchProjectCompaniesNotFound() *GetResearchProjectCompaniesNotFound {
	return &GetResearchProjectCompaniesNotFound{}
}

// GetResearchProjectCompaniesNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type GetResearchProjectCompaniesNotFound struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this get research project companies not found response has a 2xx status code
func (o *GetResearchProjectCompaniesNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get research project companies not found response has a 3xx status code
func (o *GetResearchProjectCompaniesNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get research project companies not found response has a 4xx status code
func (o *GetResearchProjectCompaniesNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this get research project companies not found response has a 5xx status code
func (o *GetResearchProjectCompaniesNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this get research project companies not found response a status code equal to that given
func (o *GetResearchProjectCompaniesNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the get research project companies not found response
func (o *GetResearchProjectCompaniesNotFound) Code() int {
	return 404
}

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

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

func (o *GetResearchProjectCompaniesNotFound) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewGetResearchProjectCompaniesUnprocessableEntity creates a GetResearchProjectCompaniesUnprocessableEntity with default headers values
func NewGetResearchProjectCompaniesUnprocessableEntity() *GetResearchProjectCompaniesUnprocessableEntity {
	return &GetResearchProjectCompaniesUnprocessableEntity{}
}

// GetResearchProjectCompaniesUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type GetResearchProjectCompaniesUnprocessableEntity struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this get research project companies unprocessable entity response has a 2xx status code
func (o *GetResearchProjectCompaniesUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get research project companies unprocessable entity response has a 3xx status code
func (o *GetResearchProjectCompaniesUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get research project companies unprocessable entity response has a 4xx status code
func (o *GetResearchProjectCompaniesUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this get research project companies unprocessable entity response has a 5xx status code
func (o *GetResearchProjectCompaniesUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this get research project companies unprocessable entity response a status code equal to that given
func (o *GetResearchProjectCompaniesUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the get research project companies unprocessable entity response
func (o *GetResearchProjectCompaniesUnprocessableEntity) Code() int {
	return 422
}

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

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

func (o *GetResearchProjectCompaniesUnprocessableEntity) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewGetResearchProjectCompaniesInternalServerError creates a GetResearchProjectCompaniesInternalServerError with default headers values
func NewGetResearchProjectCompaniesInternalServerError() *GetResearchProjectCompaniesInternalServerError {
	return &GetResearchProjectCompaniesInternalServerError{}
}

// GetResearchProjectCompaniesInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type GetResearchProjectCompaniesInternalServerError struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this get research project companies internal server error response has a 2xx status code
func (o *GetResearchProjectCompaniesInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get research project companies internal server error response has a 3xx status code
func (o *GetResearchProjectCompaniesInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get research project companies internal server error response has a 4xx status code
func (o *GetResearchProjectCompaniesInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this get research project companies internal server error response has a 5xx status code
func (o *GetResearchProjectCompaniesInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this get research project companies internal server error response a status code equal to that given
func (o *GetResearchProjectCompaniesInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the get research project companies internal server error response
func (o *GetResearchProjectCompaniesInternalServerError) Code() int {
	return 500
}

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

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

func (o *GetResearchProjectCompaniesInternalServerError) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}
