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

// UpdateEventReader is a Reader for the UpdateEvent structure.
type UpdateEventReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UpdateEventReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewUpdateEventOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewUpdateEventUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewUpdateEventForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewUpdateEventNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewUpdateEventUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewUpdateEventInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /events] updateEvent", response, response.Code())
	}
}

// NewUpdateEventOK creates a UpdateEventOK with default headers values
func NewUpdateEventOK() *UpdateEventOK {
	return &UpdateEventOK{}
}

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

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

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

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

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

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

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

func (o *UpdateEventOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventOK %s", 200, payload)
}

func (o *UpdateEventOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventOK %s", 200, payload)
}

func (o *UpdateEventOK) GetPayload() *sfgate_models.EventResponse {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.EventResponse)

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

	return nil
}

// NewUpdateEventUnauthorized creates a UpdateEventUnauthorized with default headers values
func NewUpdateEventUnauthorized() *UpdateEventUnauthorized {
	return &UpdateEventUnauthorized{}
}

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

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

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

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

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

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

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

func (o *UpdateEventUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventUnauthorized %s", 401, payload)
}

func (o *UpdateEventUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventUnauthorized %s", 401, payload)
}

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

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

// NewUpdateEventForbidden creates a UpdateEventForbidden with default headers values
func NewUpdateEventForbidden() *UpdateEventForbidden {
	return &UpdateEventForbidden{}
}

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

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

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

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

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

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

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

func (o *UpdateEventForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventForbidden %s", 403, payload)
}

func (o *UpdateEventForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventForbidden %s", 403, payload)
}

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

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

// NewUpdateEventNotFound creates a UpdateEventNotFound with default headers values
func NewUpdateEventNotFound() *UpdateEventNotFound {
	return &UpdateEventNotFound{}
}

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

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

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

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

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

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

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

func (o *UpdateEventNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventNotFound %s", 404, payload)
}

func (o *UpdateEventNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventNotFound %s", 404, payload)
}

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

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

// NewUpdateEventUnprocessableEntity creates a UpdateEventUnprocessableEntity with default headers values
func NewUpdateEventUnprocessableEntity() *UpdateEventUnprocessableEntity {
	return &UpdateEventUnprocessableEntity{}
}

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

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

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

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

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

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

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

func (o *UpdateEventUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventUnprocessableEntity %s", 422, payload)
}

func (o *UpdateEventUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventUnprocessableEntity %s", 422, payload)
}

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

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

// NewUpdateEventInternalServerError creates a UpdateEventInternalServerError with default headers values
func NewUpdateEventInternalServerError() *UpdateEventInternalServerError {
	return &UpdateEventInternalServerError{}
}

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

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

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

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

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

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

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

func (o *UpdateEventInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventInternalServerError %s", 500, payload)
}

func (o *UpdateEventInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /events][%d] updateEventInternalServerError %s", 500, payload)
}

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

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