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

// GetEventsReader is a Reader for the GetEvents structure.
type GetEventsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetEventsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetEventsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetEventsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetEventsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetEventsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetEventsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /events] getEvents", response, response.Code())
	}
}

// NewGetEventsOK creates a GetEventsOK with default headers values
func NewGetEventsOK() *GetEventsOK {
	return &GetEventsOK{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetEventsUnauthorized creates a GetEventsUnauthorized with default headers values
func NewGetEventsUnauthorized() *GetEventsUnauthorized {
	return &GetEventsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetEventsForbidden creates a GetEventsForbidden with default headers values
func NewGetEventsForbidden() *GetEventsForbidden {
	return &GetEventsForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetEventsNotFound creates a GetEventsNotFound with default headers values
func NewGetEventsNotFound() *GetEventsNotFound {
	return &GetEventsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetEventsUnprocessableEntity creates a GetEventsUnprocessableEntity with default headers values
func NewGetEventsUnprocessableEntity() *GetEventsUnprocessableEntity {
	return &GetEventsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetEventsInternalServerError creates a GetEventsInternalServerError with default headers values
func NewGetEventsInternalServerError() *GetEventsInternalServerError {
	return &GetEventsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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