// 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/members/members_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// PutEventsReader is a Reader for the PutEvents structure.
type PutEventsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutEventsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutEventsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutEventsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutEventsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPutEventsConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutEventsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutEventsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /events] putEvents", response, response.Code())
	}
}

// NewPutEventsOK creates a PutEventsOK with default headers values
func NewPutEventsOK() *PutEventsOK {
	return &PutEventsOK{}
}

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

// IsSuccess returns true when this put events o k response has a 2xx status code
func (o *PutEventsOK) IsSuccess() bool {
	return true
}

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

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

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

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

// Code gets the status code for the put events o k response
func (o *PutEventsOK) Code() int {
	return 200
}

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

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

func (o *PutEventsOK) GetPayload() *members_models.EventResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.EventResponse)

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

	return nil
}

// NewPutEventsUnauthorized creates a PutEventsUnauthorized with default headers values
func NewPutEventsUnauthorized() *PutEventsUnauthorized {
	return &PutEventsUnauthorized{}
}

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

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

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

// IsClientError returns true when this put events unauthorized response has a 4xx status code
func (o *PutEventsUnauthorized) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the put events unauthorized response
func (o *PutEventsUnauthorized) Code() int {
	return 401
}

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

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

func (o *PutEventsUnauthorized) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutEventsForbidden creates a PutEventsForbidden with default headers values
func NewPutEventsForbidden() *PutEventsForbidden {
	return &PutEventsForbidden{}
}

// PutEventsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type PutEventsForbidden struct {
	AccessControlAllowOrigin string

	Payload *members_models.Error
}

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

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

// IsClientError returns true when this put events forbidden response has a 4xx status code
func (o *PutEventsForbidden) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the put events forbidden response
func (o *PutEventsForbidden) Code() int {
	return 403
}

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

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

func (o *PutEventsForbidden) GetPayload() *members_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutEventsNotFound creates a PutEventsNotFound with default headers values
func NewPutEventsNotFound() *PutEventsNotFound {
	return &PutEventsNotFound{}
}

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

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

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

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

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

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

// Code gets the status code for the put events not found response
func (o *PutEventsNotFound) Code() int {
	return 404
}

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

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

func (o *PutEventsNotFound) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutEventsConflict creates a PutEventsConflict with default headers values
func NewPutEventsConflict() *PutEventsConflict {
	return &PutEventsConflict{}
}

// PutEventsConflict describes a response with status code 409, with default header values.
//
// The supplied LastModifiedDate is stale; reload the record before retrying.
type PutEventsConflict struct {
	Payload *members_models.Error
}

// IsSuccess returns true when this put events conflict response has a 2xx status code
func (o *PutEventsConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put events conflict response has a 3xx status code
func (o *PutEventsConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put events conflict response has a 4xx status code
func (o *PutEventsConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this put events conflict response has a 5xx status code
func (o *PutEventsConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this put events conflict response a status code equal to that given
func (o *PutEventsConflict) IsCode(code int) bool {
	return code == 409
}

// Code gets the status code for the put events conflict response
func (o *PutEventsConflict) Code() int {
	return 409
}

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

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

func (o *PutEventsConflict) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutEventsUnprocessableEntity creates a PutEventsUnprocessableEntity with default headers values
func NewPutEventsUnprocessableEntity() *PutEventsUnprocessableEntity {
	return &PutEventsUnprocessableEntity{}
}

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

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

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

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

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

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

// Code gets the status code for the put events unprocessable entity response
func (o *PutEventsUnprocessableEntity) Code() int {
	return 422
}

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

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

func (o *PutEventsUnprocessableEntity) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutEventsInternalServerError creates a PutEventsInternalServerError with default headers values
func NewPutEventsInternalServerError() *PutEventsInternalServerError {
	return &PutEventsInternalServerError{}
}

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

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

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

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

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

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

// Code gets the status code for the put events internal server error response
func (o *PutEventsInternalServerError) Code() int {
	return 500
}

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

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

func (o *PutEventsInternalServerError) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}
