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

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

// PostEventCategoriesReader is a Reader for the PostEventCategories structure.
type PostEventCategoriesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostEventCategoriesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostEventCategoriesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostEventCategoriesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostEventCategoriesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostEventCategoriesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostEventCategoriesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostEventCategoriesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /eventcategories] postEventCategories", response, response.Code())
	}
}

// NewPostEventCategoriesOK creates a PostEventCategoriesOK with default headers values
func NewPostEventCategoriesOK() *PostEventCategoriesOK {
	return &PostEventCategoriesOK{}
}

// PostEventCategoriesOK describes a response with status code 200, with default header values.
//
// Event Response Object
type PostEventCategoriesOK struct {
	Payload *sfgate_models.EventCategoryResponse
}

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

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

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

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

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

// Code gets the status code for the post event categories o k response
func (o *PostEventCategoriesOK) Code() int {
	return 200
}

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

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

func (o *PostEventCategoriesOK) GetPayload() *sfgate_models.EventCategoryResponse {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.EventCategoryResponse)

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

	return nil
}

// NewPostEventCategoriesUnauthorized creates a PostEventCategoriesUnauthorized with default headers values
func NewPostEventCategoriesUnauthorized() *PostEventCategoriesUnauthorized {
	return &PostEventCategoriesUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostEventCategoriesForbidden creates a PostEventCategoriesForbidden with default headers values
func NewPostEventCategoriesForbidden() *PostEventCategoriesForbidden {
	return &PostEventCategoriesForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostEventCategoriesNotFound creates a PostEventCategoriesNotFound with default headers values
func NewPostEventCategoriesNotFound() *PostEventCategoriesNotFound {
	return &PostEventCategoriesNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostEventCategoriesUnprocessableEntity creates a PostEventCategoriesUnprocessableEntity with default headers values
func NewPostEventCategoriesUnprocessableEntity() *PostEventCategoriesUnprocessableEntity {
	return &PostEventCategoriesUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostEventCategoriesInternalServerError creates a PostEventCategoriesInternalServerError with default headers values
func NewPostEventCategoriesInternalServerError() *PostEventCategoriesInternalServerError {
	return &PostEventCategoriesInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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