// Code generated by go-swagger; DO NOT EDIT.

// (c) 2012-2023 by Vernon Keenan
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package events

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"code.tnxs.net/work/lib/api/members/members_models"
)

// PostEventsReader is a Reader for the PostEvents structure.
type PostEventsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostEventsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostEventsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostEventsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostEventsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostEventsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostEventsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
	}
}

// NewPostEventsOK creates a PostEventsOK with default headers values
func NewPostEventsOK() *PostEventsOK {
	return &PostEventsOK{}
}

/*
PostEventsOK describes a response with status code 200, with default header values.

Event Response Object
*/
type PostEventsOK struct {
	Payload *members_models.EventResponse
}

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

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

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

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

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

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

func (o *PostEventsOK) Error() string {
	return fmt.Sprintf("[POST /events][%d] postEventsOK  %+v", 200, o.Payload)
}

func (o *PostEventsOK) String() string {
	return fmt.Sprintf("[POST /events][%d] postEventsOK  %+v", 200, o.Payload)
}

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

func (o *PostEventsOK) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostEventsUnauthorized creates a PostEventsUnauthorized with default headers values
func NewPostEventsUnauthorized() *PostEventsUnauthorized {
	return &PostEventsUnauthorized{}
}

/*
PostEventsUnauthorized describes a response with status code 401, with default header values.

Access Unauthorized, invalid API-KEY was used
*/
type PostEventsUnauthorized struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostEventsUnauthorized) Error() string {
	return fmt.Sprintf("[POST /events][%d] postEventsUnauthorized  %+v", 401, o.Payload)
}

func (o *PostEventsUnauthorized) String() string {
	return fmt.Sprintf("[POST /events][%d] postEventsUnauthorized  %+v", 401, o.Payload)
}

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

func (o *PostEventsUnauthorized) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostEventsForbidden creates a PostEventsForbidden with default headers values
func NewPostEventsForbidden() *PostEventsForbidden {
	return &PostEventsForbidden{}
}

/*
PostEventsForbidden describes a response with status code 403, with default header values.

Access forbidden, account lacks access
*/
type PostEventsForbidden struct {
	AccessControlAllowOrigin string

	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostEventsForbidden) Error() string {
	return fmt.Sprintf("[POST /events][%d] postEventsForbidden  %+v", 403, o.Payload)
}

func (o *PostEventsForbidden) String() string {
	return fmt.Sprintf("[POST /events][%d] postEventsForbidden  %+v", 403, o.Payload)
}

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

func (o *PostEventsForbidden) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostEventsNotFound creates a PostEventsNotFound with default headers values
func NewPostEventsNotFound() *PostEventsNotFound {
	return &PostEventsNotFound{}
}

/*
PostEventsNotFound describes a response with status code 404, with default header values.

Resource was not found
*/
type PostEventsNotFound struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostEventsNotFound) Error() string {
	return fmt.Sprintf("[POST /events][%d] postEventsNotFound  %+v", 404, o.Payload)
}

func (o *PostEventsNotFound) String() string {
	return fmt.Sprintf("[POST /events][%d] postEventsNotFound  %+v", 404, o.Payload)
}

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

func (o *PostEventsNotFound) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostEventsUnprocessableEntity creates a PostEventsUnprocessableEntity with default headers values
func NewPostEventsUnprocessableEntity() *PostEventsUnprocessableEntity {
	return &PostEventsUnprocessableEntity{}
}

/*
PostEventsUnprocessableEntity describes a response with status code 422, with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PostEventsUnprocessableEntity struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostEventsUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /events][%d] postEventsUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *PostEventsUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /events][%d] postEventsUnprocessableEntity  %+v", 422, o.Payload)
}

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

func (o *PostEventsUnprocessableEntity) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostEventsInternalServerError creates a PostEventsInternalServerError with default headers values
func NewPostEventsInternalServerError() *PostEventsInternalServerError {
	return &PostEventsInternalServerError{}
}

/*
PostEventsInternalServerError describes a response with status code 500, with default header values.

Server Internal Error
*/
type PostEventsInternalServerError struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostEventsInternalServerError) Error() string {
	return fmt.Sprintf("[POST /events][%d] postEventsInternalServerError  %+v", 500, o.Payload)
}

func (o *PostEventsInternalServerError) String() string {
	return fmt.Sprintf("[POST /events][%d] postEventsInternalServerError  %+v", 500, o.Payload)
}

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

func (o *PostEventsInternalServerError) 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 && err != io.EOF {
		return err
	}

	return nil
}
