// 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/sfgate/sfgate_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 201:
		result := NewPostCompanyServicesCreated()
		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 404:
		result := NewPostCompanyServicesNotFound()
		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())
	}
}

// NewPostCompanyServicesCreated creates a PostCompanyServicesCreated with default headers values
func NewPostCompanyServicesCreated() *PostCompanyServicesCreated {
	return &PostCompanyServicesCreated{}
}

// PostCompanyServicesCreated describes a response with status code 201, with default header values.
//
// Response from Salesforce
type PostCompanyServicesCreated struct {
	Payload *sfgate_models.SalesforcePostResponse
}

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

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

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

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

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

// Code gets the status code for the post company services created response
func (o *PostCompanyServicesCreated) Code() int {
	return 201
}

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

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

func (o *PostCompanyServicesCreated) GetPayload() *sfgate_models.SalesforcePostResponse {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.SalesforcePostResponse)

	// 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 {
	Payload *sfgate_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() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_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 {
	Payload *sfgate_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() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPostCompanyServicesNotFound creates a PostCompanyServicesNotFound with default headers values
func NewPostCompanyServicesNotFound() *PostCompanyServicesNotFound {
	return &PostCompanyServicesNotFound{}
}

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

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

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

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

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

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

// Code gets the status code for the post company services not found response
func (o *PostCompanyServicesNotFound) Code() int {
	return 404
}

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

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

func (o *PostCompanyServicesNotFound) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_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 {
	Payload *sfgate_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() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_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 {
	Payload *sfgate_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() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}
