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

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

// PostIndustriesReader is a Reader for the PostIndustries structure.
type PostIndustriesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostIndustriesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 201:
		result := NewPostIndustriesCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostIndustriesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostIndustriesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostIndustriesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostIndustriesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostIndustriesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /industries] postIndustries", response, response.Code())
	}
}

// NewPostIndustriesCreated creates a PostIndustriesCreated with default headers values
func NewPostIndustriesCreated() *PostIndustriesCreated {
	return &PostIndustriesCreated{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostIndustriesUnauthorized creates a PostIndustriesUnauthorized with default headers values
func NewPostIndustriesUnauthorized() *PostIndustriesUnauthorized {
	return &PostIndustriesUnauthorized{}
}

// PostIndustriesUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
type PostIndustriesUnauthorized struct {
	Payload *sfgate_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostIndustriesForbidden creates a PostIndustriesForbidden with default headers values
func NewPostIndustriesForbidden() *PostIndustriesForbidden {
	return &PostIndustriesForbidden{}
}

// PostIndustriesForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type PostIndustriesForbidden struct {
	Payload *sfgate_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostIndustriesNotFound creates a PostIndustriesNotFound with default headers values
func NewPostIndustriesNotFound() *PostIndustriesNotFound {
	return &PostIndustriesNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostIndustriesUnprocessableEntity creates a PostIndustriesUnprocessableEntity with default headers values
func NewPostIndustriesUnprocessableEntity() *PostIndustriesUnprocessableEntity {
	return &PostIndustriesUnprocessableEntity{}
}

// PostIndustriesUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type PostIndustriesUnprocessableEntity struct {
	Payload *sfgate_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostIndustriesInternalServerError creates a PostIndustriesInternalServerError with default headers values
func NewPostIndustriesInternalServerError() *PostIndustriesInternalServerError {
	return &PostIndustriesInternalServerError{}
}

// PostIndustriesInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type PostIndustriesInternalServerError struct {
	Payload *sfgate_models.Error
}

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

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

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

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

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

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

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

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

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

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