// 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 emails

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

// GetOutgoingEmailMessagesReader is a Reader for the GetOutgoingEmailMessages structure.
type GetOutgoingEmailMessagesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetOutgoingEmailMessagesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetOutgoingEmailMessagesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetOutgoingEmailMessagesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetOutgoingEmailMessagesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetOutgoingEmailMessagesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetOutgoingEmailMessagesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetOutgoingEmailMessagesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /outgoingemailmessages] getOutgoingEmailMessages", response, response.Code())
	}
}

// NewGetOutgoingEmailMessagesOK creates a GetOutgoingEmailMessagesOK with default headers values
func NewGetOutgoingEmailMessagesOK() *GetOutgoingEmailMessagesOK {
	return &GetOutgoingEmailMessagesOK{}
}

// GetOutgoingEmailMessagesOK describes a response with status code 200, with default header values.
//
// Array of Outgoing Email Messages
type GetOutgoingEmailMessagesOK struct {
	Payload *members_models.OutgoingEmailMessagesResponse
}

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

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

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

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

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

// Code gets the status code for the get outgoing email messages o k response
func (o *GetOutgoingEmailMessagesOK) Code() int {
	return 200
}

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

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

func (o *GetOutgoingEmailMessagesOK) GetPayload() *members_models.OutgoingEmailMessagesResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.OutgoingEmailMessagesResponse)

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

	return nil
}

// NewGetOutgoingEmailMessagesUnauthorized creates a GetOutgoingEmailMessagesUnauthorized with default headers values
func NewGetOutgoingEmailMessagesUnauthorized() *GetOutgoingEmailMessagesUnauthorized {
	return &GetOutgoingEmailMessagesUnauthorized{}
}

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

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

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

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

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

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

// Code gets the status code for the get outgoing email messages unauthorized response
func (o *GetOutgoingEmailMessagesUnauthorized) Code() int {
	return 401
}

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

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

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

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

// NewGetOutgoingEmailMessagesForbidden creates a GetOutgoingEmailMessagesForbidden with default headers values
func NewGetOutgoingEmailMessagesForbidden() *GetOutgoingEmailMessagesForbidden {
	return &GetOutgoingEmailMessagesForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

// Code gets the status code for the get outgoing email messages forbidden response
func (o *GetOutgoingEmailMessagesForbidden) Code() int {
	return 403
}

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

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

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

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

// NewGetOutgoingEmailMessagesNotFound creates a GetOutgoingEmailMessagesNotFound with default headers values
func NewGetOutgoingEmailMessagesNotFound() *GetOutgoingEmailMessagesNotFound {
	return &GetOutgoingEmailMessagesNotFound{}
}

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

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

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

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

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

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

// Code gets the status code for the get outgoing email messages not found response
func (o *GetOutgoingEmailMessagesNotFound) Code() int {
	return 404
}

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

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

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

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

// NewGetOutgoingEmailMessagesUnprocessableEntity creates a GetOutgoingEmailMessagesUnprocessableEntity with default headers values
func NewGetOutgoingEmailMessagesUnprocessableEntity() *GetOutgoingEmailMessagesUnprocessableEntity {
	return &GetOutgoingEmailMessagesUnprocessableEntity{}
}

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

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

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

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

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

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

// Code gets the status code for the get outgoing email messages unprocessable entity response
func (o *GetOutgoingEmailMessagesUnprocessableEntity) Code() int {
	return 422
}

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

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

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

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

// NewGetOutgoingEmailMessagesInternalServerError creates a GetOutgoingEmailMessagesInternalServerError with default headers values
func NewGetOutgoingEmailMessagesInternalServerError() *GetOutgoingEmailMessagesInternalServerError {
	return &GetOutgoingEmailMessagesInternalServerError{}
}

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

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

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

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

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

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

// Code gets the status code for the get outgoing email messages internal server error response
func (o *GetOutgoingEmailMessagesInternalServerError) Code() int {
	return 500
}

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

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

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

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