// Code generated by go-swagger; DO NOT EDIT.

// (c) 2012-2023 by Vernon Keenan
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package company_products

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"code.tnxs.net/work/lib/api/sfgate/sfgate_models"
)

// PostCompanyProductsReader is a Reader for the PostCompanyProducts structure.
type PostCompanyProductsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCompanyProductsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewPostCompanyProductsCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostCompanyProductsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostCompanyProductsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostCompanyProductsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostCompanyProductsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostCompanyProductsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
	}
}

// NewPostCompanyProductsCreated creates a PostCompanyProductsCreated with default headers values
func NewPostCompanyProductsCreated() *PostCompanyProductsCreated {
	return &PostCompanyProductsCreated{}
}

/*
PostCompanyProductsCreated describes a response with status code 201, with default header values.

Response from Salesforce
*/
type PostCompanyProductsCreated struct {
	Payload *sfgate_models.SalesforcePostResponse
}

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

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

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

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

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

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

func (o *PostCompanyProductsCreated) Error() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsCreated  %+v", 201, o.Payload)
}

func (o *PostCompanyProductsCreated) String() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsCreated  %+v", 201, o.Payload)
}

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

func (o *PostCompanyProductsCreated) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCompanyProductsUnauthorized creates a PostCompanyProductsUnauthorized with default headers values
func NewPostCompanyProductsUnauthorized() *PostCompanyProductsUnauthorized {
	return &PostCompanyProductsUnauthorized{}
}

/*
PostCompanyProductsUnauthorized describes a response with status code 401, with default header values.

Access unauthorized, invalid API-KEY was used
*/
type PostCompanyProductsUnauthorized struct {
	Payload *sfgate_models.Error
}

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

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

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

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

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

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

func (o *PostCompanyProductsUnauthorized) Error() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsUnauthorized  %+v", 401, o.Payload)
}

func (o *PostCompanyProductsUnauthorized) String() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsUnauthorized  %+v", 401, o.Payload)
}

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

func (o *PostCompanyProductsUnauthorized) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCompanyProductsForbidden creates a PostCompanyProductsForbidden with default headers values
func NewPostCompanyProductsForbidden() *PostCompanyProductsForbidden {
	return &PostCompanyProductsForbidden{}
}

/*
PostCompanyProductsForbidden describes a response with status code 403, with default header values.

Access forbidden, account lacks access
*/
type PostCompanyProductsForbidden struct {
	Payload *sfgate_models.Error
}

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

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

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

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

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

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

func (o *PostCompanyProductsForbidden) Error() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsForbidden  %+v", 403, o.Payload)
}

func (o *PostCompanyProductsForbidden) String() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsForbidden  %+v", 403, o.Payload)
}

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

func (o *PostCompanyProductsForbidden) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCompanyProductsNotFound creates a PostCompanyProductsNotFound with default headers values
func NewPostCompanyProductsNotFound() *PostCompanyProductsNotFound {
	return &PostCompanyProductsNotFound{}
}

/*
PostCompanyProductsNotFound describes a response with status code 404, with default header values.

Resource was not found
*/
type PostCompanyProductsNotFound struct {
	Payload *sfgate_models.Error
}

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

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

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

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

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

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

func (o *PostCompanyProductsNotFound) Error() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsNotFound  %+v", 404, o.Payload)
}

func (o *PostCompanyProductsNotFound) String() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsNotFound  %+v", 404, o.Payload)
}

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

func (o *PostCompanyProductsNotFound) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCompanyProductsUnprocessableEntity creates a PostCompanyProductsUnprocessableEntity with default headers values
func NewPostCompanyProductsUnprocessableEntity() *PostCompanyProductsUnprocessableEntity {
	return &PostCompanyProductsUnprocessableEntity{}
}

/*
PostCompanyProductsUnprocessableEntity describes a response with status code 422, with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PostCompanyProductsUnprocessableEntity struct {
	Payload *sfgate_models.Error
}

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

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

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

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

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

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

func (o *PostCompanyProductsUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *PostCompanyProductsUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsUnprocessableEntity  %+v", 422, o.Payload)
}

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

func (o *PostCompanyProductsUnprocessableEntity) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCompanyProductsInternalServerError creates a PostCompanyProductsInternalServerError with default headers values
func NewPostCompanyProductsInternalServerError() *PostCompanyProductsInternalServerError {
	return &PostCompanyProductsInternalServerError{}
}

/*
PostCompanyProductsInternalServerError describes a response with status code 500, with default header values.

Server Internal Error
*/
type PostCompanyProductsInternalServerError struct {
	Payload *sfgate_models.Error
}

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

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

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

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

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

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

func (o *PostCompanyProductsInternalServerError) Error() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsInternalServerError  %+v", 500, o.Payload)
}

func (o *PostCompanyProductsInternalServerError) String() string {
	return fmt.Sprintf("[POST /companyproducts][%d] postCompanyProductsInternalServerError  %+v", 500, o.Payload)
}

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

func (o *PostCompanyProductsInternalServerError) 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 && err != io.EOF {
		return err
	}

	return nil
}
