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

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

// PutCompanyServiceReader is a Reader for the PutCompanyService structure.
type PutCompanyServiceReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutCompanyServiceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutCompanyServiceOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutCompanyServiceUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutCompanyServiceForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutCompanyServiceNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPutCompanyServiceConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutCompanyServiceUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutCompanyServiceInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /companyservices] putCompanyService", response, response.Code())
	}
}

// NewPutCompanyServiceOK creates a PutCompanyServiceOK with default headers values
func NewPutCompanyServiceOK() *PutCompanyServiceOK {
	return &PutCompanyServiceOK{}
}

// PutCompanyServiceOK describes a response with status code 200, with default header values.
//
// Response with CompanyService objects
type PutCompanyServiceOK struct {
	Payload *research_models.CompanyServiceResponse
}

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

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

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

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

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

// Code gets the status code for the put company service o k response
func (o *PutCompanyServiceOK) Code() int {
	return 200
}

func (o *PutCompanyServiceOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceOK %s", 200, payload)
}

func (o *PutCompanyServiceOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceOK %s", 200, payload)
}

func (o *PutCompanyServiceOK) GetPayload() *research_models.CompanyServiceResponse {
	return o.Payload
}

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

	o.Payload = new(research_models.CompanyServiceResponse)

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

	return nil
}

// NewPutCompanyServiceUnauthorized creates a PutCompanyServiceUnauthorized with default headers values
func NewPutCompanyServiceUnauthorized() *PutCompanyServiceUnauthorized {
	return &PutCompanyServiceUnauthorized{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

// Code gets the status code for the put company service unauthorized response
func (o *PutCompanyServiceUnauthorized) Code() int {
	return 401
}

func (o *PutCompanyServiceUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceUnauthorized %s", 401, payload)
}

func (o *PutCompanyServiceUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceUnauthorized %s", 401, payload)
}

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

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

// NewPutCompanyServiceForbidden creates a PutCompanyServiceForbidden with default headers values
func NewPutCompanyServiceForbidden() *PutCompanyServiceForbidden {
	return &PutCompanyServiceForbidden{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

// Code gets the status code for the put company service forbidden response
func (o *PutCompanyServiceForbidden) Code() int {
	return 403
}

func (o *PutCompanyServiceForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceForbidden %s", 403, payload)
}

func (o *PutCompanyServiceForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceForbidden %s", 403, payload)
}

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

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

// NewPutCompanyServiceNotFound creates a PutCompanyServiceNotFound with default headers values
func NewPutCompanyServiceNotFound() *PutCompanyServiceNotFound {
	return &PutCompanyServiceNotFound{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

// Code gets the status code for the put company service not found response
func (o *PutCompanyServiceNotFound) Code() int {
	return 404
}

func (o *PutCompanyServiceNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceNotFound %s", 404, payload)
}

func (o *PutCompanyServiceNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceNotFound %s", 404, payload)
}

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

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

// NewPutCompanyServiceConflict creates a PutCompanyServiceConflict with default headers values
func NewPutCompanyServiceConflict() *PutCompanyServiceConflict {
	return &PutCompanyServiceConflict{}
}

// PutCompanyServiceConflict describes a response with status code 409, with default header values.
//
// Conflict
type PutCompanyServiceConflict struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

// IsSuccess returns true when this put company service conflict response has a 2xx status code
func (o *PutCompanyServiceConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put company service conflict response has a 3xx status code
func (o *PutCompanyServiceConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put company service conflict response has a 4xx status code
func (o *PutCompanyServiceConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this put company service conflict response has a 5xx status code
func (o *PutCompanyServiceConflict) IsServerError() bool {
	return false
}

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

// Code gets the status code for the put company service conflict response
func (o *PutCompanyServiceConflict) Code() int {
	return 409
}

func (o *PutCompanyServiceConflict) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceConflict %s", 409, payload)
}

func (o *PutCompanyServiceConflict) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceConflict %s", 409, payload)
}

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

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

// NewPutCompanyServiceUnprocessableEntity creates a PutCompanyServiceUnprocessableEntity with default headers values
func NewPutCompanyServiceUnprocessableEntity() *PutCompanyServiceUnprocessableEntity {
	return &PutCompanyServiceUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

// Code gets the status code for the put company service unprocessable entity response
func (o *PutCompanyServiceUnprocessableEntity) Code() int {
	return 422
}

func (o *PutCompanyServiceUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceUnprocessableEntity %s", 422, payload)
}

func (o *PutCompanyServiceUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceUnprocessableEntity %s", 422, payload)
}

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

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

// NewPutCompanyServiceInternalServerError creates a PutCompanyServiceInternalServerError with default headers values
func NewPutCompanyServiceInternalServerError() *PutCompanyServiceInternalServerError {
	return &PutCompanyServiceInternalServerError{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

// Code gets the status code for the put company service internal server error response
func (o *PutCompanyServiceInternalServerError) Code() int {
	return 500
}

func (o *PutCompanyServiceInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceInternalServerError %s", 500, payload)
}

func (o *PutCompanyServiceInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /companyservices][%d] putCompanyServiceInternalServerError %s", 500, payload)
}

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

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