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

// PostOutgoingEmailMessagesReader is a Reader for the PostOutgoingEmailMessages structure.
type PostOutgoingEmailMessagesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostOutgoingEmailMessagesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostOutgoingEmailMessagesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostOutgoingEmailMessagesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostOutgoingEmailMessagesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostOutgoingEmailMessagesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostOutgoingEmailMessagesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostOutgoingEmailMessagesInternalServerError()
		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())
	}
}

// NewPostOutgoingEmailMessagesOK creates a PostOutgoingEmailMessagesOK with default headers values
func NewPostOutgoingEmailMessagesOK() *PostOutgoingEmailMessagesOK {
	return &PostOutgoingEmailMessagesOK{}
}

/*PostOutgoingEmailMessagesOK handles this case with default header values.

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

	Payload *workflow_models.EmailMessagesResponse
}

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

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

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

// NewPostOutgoingEmailMessagesUnauthorized creates a PostOutgoingEmailMessagesUnauthorized with default headers values
func NewPostOutgoingEmailMessagesUnauthorized() *PostOutgoingEmailMessagesUnauthorized {
	return &PostOutgoingEmailMessagesUnauthorized{}
}

/*PostOutgoingEmailMessagesUnauthorized handles this case with default header values.

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

	Payload *workflow_models.Error
}

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

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

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

// NewPostOutgoingEmailMessagesForbidden creates a PostOutgoingEmailMessagesForbidden with default headers values
func NewPostOutgoingEmailMessagesForbidden() *PostOutgoingEmailMessagesForbidden {
	return &PostOutgoingEmailMessagesForbidden{}
}

/*PostOutgoingEmailMessagesForbidden handles this case with default header values.

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

	Payload *workflow_models.Error
}

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

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

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

// NewPostOutgoingEmailMessagesNotFound creates a PostOutgoingEmailMessagesNotFound with default headers values
func NewPostOutgoingEmailMessagesNotFound() *PostOutgoingEmailMessagesNotFound {
	return &PostOutgoingEmailMessagesNotFound{}
}

/*PostOutgoingEmailMessagesNotFound handles this case with default header values.

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

	Payload *workflow_models.Error
}

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

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

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

// NewPostOutgoingEmailMessagesUnprocessableEntity creates a PostOutgoingEmailMessagesUnprocessableEntity with default headers values
func NewPostOutgoingEmailMessagesUnprocessableEntity() *PostOutgoingEmailMessagesUnprocessableEntity {
	return &PostOutgoingEmailMessagesUnprocessableEntity{}
}

/*PostOutgoingEmailMessagesUnprocessableEntity handles this case with default header values.

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

	Payload *workflow_models.Error
}

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

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

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

// NewPostOutgoingEmailMessagesInternalServerError creates a PostOutgoingEmailMessagesInternalServerError with default headers values
func NewPostOutgoingEmailMessagesInternalServerError() *PostOutgoingEmailMessagesInternalServerError {
	return &PostOutgoingEmailMessagesInternalServerError{}
}

/*PostOutgoingEmailMessagesInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostOutgoingEmailMessagesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *workflow_models.Error
}

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

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

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