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

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

// PostEmailMessagesReader is a Reader for the PostEmailMessages structure.
type PostEmailMessagesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostEmailMessagesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostEmailMessagesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostEmailMessagesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostEmailMessagesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostEmailMessagesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostEmailMessagesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostEmailMessagesInternalServerError()
		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())
	}
}

// NewPostEmailMessagesOK creates a PostEmailMessagesOK with default headers values
func NewPostEmailMessagesOK() *PostEmailMessagesOK {
	return &PostEmailMessagesOK{}
}

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

Array of Email Messages
*/
type PostEmailMessagesOK struct {
	Payload *members_models.EmailMessagesResponse
}

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

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

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

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

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

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

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

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

func (o *PostEmailMessagesOK) GetPayload() *members_models.EmailMessagesResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.EmailMessagesResponse)

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

	return nil
}

// NewPostEmailMessagesUnauthorized creates a PostEmailMessagesUnauthorized with default headers values
func NewPostEmailMessagesUnauthorized() *PostEmailMessagesUnauthorized {
	return &PostEmailMessagesUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostEmailMessagesForbidden creates a PostEmailMessagesForbidden with default headers values
func NewPostEmailMessagesForbidden() *PostEmailMessagesForbidden {
	return &PostEmailMessagesForbidden{}
}

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

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostEmailMessagesNotFound creates a PostEmailMessagesNotFound with default headers values
func NewPostEmailMessagesNotFound() *PostEmailMessagesNotFound {
	return &PostEmailMessagesNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostEmailMessagesUnprocessableEntity creates a PostEmailMessagesUnprocessableEntity with default headers values
func NewPostEmailMessagesUnprocessableEntity() *PostEmailMessagesUnprocessableEntity {
	return &PostEmailMessagesUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostEmailMessagesInternalServerError creates a PostEmailMessagesInternalServerError with default headers values
func NewPostEmailMessagesInternalServerError() *PostEmailMessagesInternalServerError {
	return &PostEmailMessagesInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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