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

// PostCompanyServicesReader is a Reader for the PostCompanyServices structure.
type PostCompanyServicesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCompanyServicesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostCompanyServicesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostCompanyServicesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostCompanyServicesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPostCompanyServicesConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostCompanyServicesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostCompanyServicesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /companyservices] postCompanyServices", response, response.Code())
	}
}

// NewPostCompanyServicesOK creates a PostCompanyServicesOK with default headers values
func NewPostCompanyServicesOK() *PostCompanyServicesOK {
	return &PostCompanyServicesOK{}
}

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

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

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

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

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

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

// Code gets the status code for the post company services o k response
func (o *PostCompanyServicesOK) Code() int {
	return 200
}

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

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

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

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

// NewPostCompanyServicesUnauthorized creates a PostCompanyServicesUnauthorized with default headers values
func NewPostCompanyServicesUnauthorized() *PostCompanyServicesUnauthorized {
	return &PostCompanyServicesUnauthorized{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

// Code gets the status code for the post company services unauthorized response
func (o *PostCompanyServicesUnauthorized) Code() int {
	return 401
}

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

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

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

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

// NewPostCompanyServicesForbidden creates a PostCompanyServicesForbidden with default headers values
func NewPostCompanyServicesForbidden() *PostCompanyServicesForbidden {
	return &PostCompanyServicesForbidden{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

// Code gets the status code for the post company services forbidden response
func (o *PostCompanyServicesForbidden) Code() int {
	return 403
}

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

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

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

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

// NewPostCompanyServicesConflict creates a PostCompanyServicesConflict with default headers values
func NewPostCompanyServicesConflict() *PostCompanyServicesConflict {
	return &PostCompanyServicesConflict{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

// Code gets the status code for the post company services conflict response
func (o *PostCompanyServicesConflict) Code() int {
	return 409
}

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

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

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

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

// NewPostCompanyServicesUnprocessableEntity creates a PostCompanyServicesUnprocessableEntity with default headers values
func NewPostCompanyServicesUnprocessableEntity() *PostCompanyServicesUnprocessableEntity {
	return &PostCompanyServicesUnprocessableEntity{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

// Code gets the status code for the post company services unprocessable entity response
func (o *PostCompanyServicesUnprocessableEntity) Code() int {
	return 422
}

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

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

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

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

// NewPostCompanyServicesInternalServerError creates a PostCompanyServicesInternalServerError with default headers values
func NewPostCompanyServicesInternalServerError() *PostCompanyServicesInternalServerError {
	return &PostCompanyServicesInternalServerError{}
}

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

	Payload *research_models.Error
}

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

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

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

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

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

// Code gets the status code for the post company services internal server error response
func (o *PostCompanyServicesInternalServerError) Code() int {
	return 500
}

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

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

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

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