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

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

// GetCompanyCategoriesReader is a Reader for the GetCompanyCategories structure.
type GetCompanyCategoriesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetCompanyCategoriesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetCompanyCategoriesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetCompanyCategoriesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetCompanyCategoriesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetCompanyCategoriesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetCompanyCategoriesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetCompanyCategoriesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /companycategories] getCompanyCategories", response, response.Code())
	}
}

// NewGetCompanyCategoriesOK creates a GetCompanyCategoriesOK with default headers values
func NewGetCompanyCategoriesOK() *GetCompanyCategoriesOK {
	return &GetCompanyCategoriesOK{}
}

// GetCompanyCategoriesOK describes a response with status code 200, with default header values.
//
// The SalesforceDevops.net CompanyCategory Object
type GetCompanyCategoriesOK struct {
	Payload *research_models.CompanyCategoryResponse
}

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

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

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

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

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

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

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

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

func (o *GetCompanyCategoriesOK) GetPayload() *research_models.CompanyCategoryResponse {
	return o.Payload
}

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

	o.Payload = new(research_models.CompanyCategoryResponse)

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

	return nil
}

// NewGetCompanyCategoriesUnauthorized creates a GetCompanyCategoriesUnauthorized with default headers values
func NewGetCompanyCategoriesUnauthorized() *GetCompanyCategoriesUnauthorized {
	return &GetCompanyCategoriesUnauthorized{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetCompanyCategoriesForbidden creates a GetCompanyCategoriesForbidden with default headers values
func NewGetCompanyCategoriesForbidden() *GetCompanyCategoriesForbidden {
	return &GetCompanyCategoriesForbidden{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetCompanyCategoriesNotFound creates a GetCompanyCategoriesNotFound with default headers values
func NewGetCompanyCategoriesNotFound() *GetCompanyCategoriesNotFound {
	return &GetCompanyCategoriesNotFound{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetCompanyCategoriesUnprocessableEntity creates a GetCompanyCategoriesUnprocessableEntity with default headers values
func NewGetCompanyCategoriesUnprocessableEntity() *GetCompanyCategoriesUnprocessableEntity {
	return &GetCompanyCategoriesUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetCompanyCategoriesInternalServerError creates a GetCompanyCategoriesInternalServerError with default headers values
func NewGetCompanyCategoriesInternalServerError() *GetCompanyCategoriesInternalServerError {
	return &GetCompanyCategoriesInternalServerError{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

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

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