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

// PostTrackEventsReader is a Reader for the PostTrackEvents structure.
type PostTrackEventsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostTrackEventsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostTrackEventsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostTrackEventsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostTrackEventsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostTrackEventsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostTrackEventsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostTrackEventsInternalServerError()
		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())
	}
}

// NewPostTrackEventsOK creates a PostTrackEventsOK with default headers values
func NewPostTrackEventsOK() *PostTrackEventsOK {
	return &PostTrackEventsOK{}
}

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

TrackEvent Response Object
*/
type PostTrackEventsOK struct {
	Payload *members_models.TrackEventResponse
}

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

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

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

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

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

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

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

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

func (o *PostTrackEventsOK) GetPayload() *members_models.TrackEventResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.TrackEventResponse)

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

	return nil
}

// NewPostTrackEventsUnauthorized creates a PostTrackEventsUnauthorized with default headers values
func NewPostTrackEventsUnauthorized() *PostTrackEventsUnauthorized {
	return &PostTrackEventsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostTrackEventsForbidden creates a PostTrackEventsForbidden with default headers values
func NewPostTrackEventsForbidden() *PostTrackEventsForbidden {
	return &PostTrackEventsForbidden{}
}

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

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostTrackEventsNotFound creates a PostTrackEventsNotFound with default headers values
func NewPostTrackEventsNotFound() *PostTrackEventsNotFound {
	return &PostTrackEventsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostTrackEventsUnprocessableEntity creates a PostTrackEventsUnprocessableEntity with default headers values
func NewPostTrackEventsUnprocessableEntity() *PostTrackEventsUnprocessableEntity {
	return &PostTrackEventsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostTrackEventsInternalServerError creates a PostTrackEventsInternalServerError with default headers values
func NewPostTrackEventsInternalServerError() *PostTrackEventsInternalServerError {
	return &PostTrackEventsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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