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

// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package email_message

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

	"github.com/taxnexus/go/lib/api/workflow/workflow_models"
)

// GetEmailMessagesReader is a Reader for the GetEmailMessages structure.
type GetEmailMessagesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetEmailMessagesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetEmailMessagesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetEmailMessagesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetEmailMessagesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetEmailMessagesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetEmailMessagesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetEmailMessagesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}

// NewGetEmailMessagesOK creates a GetEmailMessagesOK with default headers values
func NewGetEmailMessagesOK() *GetEmailMessagesOK {
	return &GetEmailMessagesOK{}
}

/*GetEmailMessagesOK handles this case with default header values.

Array of Email Messages
*/
type GetEmailMessagesOK struct {
	AccessControlAllowOrigin string

	Payload *workflow_models.EmailMessagesResponse
}

func (o *GetEmailMessagesOK) Error() string {
	return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesOK  %+v", 200, o.Payload)
}

func (o *GetEmailMessagesOK) GetPayload() *workflow_models.EmailMessagesResponse {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(workflow_models.EmailMessagesResponse)

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

	return nil
}

// NewGetEmailMessagesUnauthorized creates a GetEmailMessagesUnauthorized with default headers values
func NewGetEmailMessagesUnauthorized() *GetEmailMessagesUnauthorized {
	return &GetEmailMessagesUnauthorized{}
}

/*GetEmailMessagesUnauthorized handles this case with default header values.

Access Unauthorized, invalid API-KEY was used
*/
type GetEmailMessagesUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *workflow_models.Error
}

func (o *GetEmailMessagesUnauthorized) Error() string {
	return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesUnauthorized  %+v", 401, o.Payload)
}

func (o *GetEmailMessagesUnauthorized) GetPayload() *workflow_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(workflow_models.Error)

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

	return nil
}

// NewGetEmailMessagesForbidden creates a GetEmailMessagesForbidden with default headers values
func NewGetEmailMessagesForbidden() *GetEmailMessagesForbidden {
	return &GetEmailMessagesForbidden{}
}

/*GetEmailMessagesForbidden handles this case with default header values.

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

	Payload *workflow_models.Error
}

func (o *GetEmailMessagesForbidden) Error() string {
	return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesForbidden  %+v", 403, o.Payload)
}

func (o *GetEmailMessagesForbidden) GetPayload() *workflow_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(workflow_models.Error)

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

	return nil
}

// NewGetEmailMessagesNotFound creates a GetEmailMessagesNotFound with default headers values
func NewGetEmailMessagesNotFound() *GetEmailMessagesNotFound {
	return &GetEmailMessagesNotFound{}
}

/*GetEmailMessagesNotFound handles this case with default header values.

Resource was not found
*/
type GetEmailMessagesNotFound struct {
	AccessControlAllowOrigin string

	Payload *workflow_models.Error
}

func (o *GetEmailMessagesNotFound) Error() string {
	return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesNotFound  %+v", 404, o.Payload)
}

func (o *GetEmailMessagesNotFound) GetPayload() *workflow_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(workflow_models.Error)

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

	return nil
}

// NewGetEmailMessagesUnprocessableEntity creates a GetEmailMessagesUnprocessableEntity with default headers values
func NewGetEmailMessagesUnprocessableEntity() *GetEmailMessagesUnprocessableEntity {
	return &GetEmailMessagesUnprocessableEntity{}
}

/*GetEmailMessagesUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type GetEmailMessagesUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *workflow_models.Error
}

func (o *GetEmailMessagesUnprocessableEntity) Error() string {
	return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *GetEmailMessagesUnprocessableEntity) GetPayload() *workflow_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(workflow_models.Error)

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

	return nil
}

// NewGetEmailMessagesInternalServerError creates a GetEmailMessagesInternalServerError with default headers values
func NewGetEmailMessagesInternalServerError() *GetEmailMessagesInternalServerError {
	return &GetEmailMessagesInternalServerError{}
}

/*GetEmailMessagesInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetEmailMessagesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *workflow_models.Error
}

func (o *GetEmailMessagesInternalServerError) Error() string {
	return fmt.Sprintf("[GET /emailmessages][%d] getEmailMessagesInternalServerError  %+v", 500, o.Payload)
}

func (o *GetEmailMessagesInternalServerError) GetPayload() *workflow_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(workflow_models.Error)

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

	return nil
}
