package mail

import (
	"context"
	"fmt"
	"io"
	"strconv"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"

	"github.com/ferocious-space/eveapi/models"
)

type PutCharactersCharacterIDMailMailIDReader struct {
	formats strfmt.Registry
}

func (o *PutCharactersCharacterIDMailMailIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 204:
		result := NewPutCharactersCharacterIDMailMailIDNoContent()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutCharactersCharacterIDMailMailIDBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPutCharactersCharacterIDMailMailIDUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutCharactersCharacterIDMailMailIDForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 420:
		result := NewPutCharactersCharacterIDMailMailIDEnhanceYourCalm()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutCharactersCharacterIDMailMailIDInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPutCharactersCharacterIDMailMailIDServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 504:
		result := NewPutCharactersCharacterIDMailMailIDGatewayTimeout()
		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())
	}
}

func NewPutCharactersCharacterIDMailMailIDNoContent() *PutCharactersCharacterIDMailMailIDNoContent {
	return &PutCharactersCharacterIDMailMailIDNoContent{}
}

type PutCharactersCharacterIDMailMailIDNoContent struct {
}

func (o *PutCharactersCharacterIDMailMailIDNoContent) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdNoContent ", 204)
}

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

	return nil
}

func NewPutCharactersCharacterIDMailMailIDBadRequest() *PutCharactersCharacterIDMailMailIDBadRequest {
	return &PutCharactersCharacterIDMailMailIDBadRequest{}
}

type PutCharactersCharacterIDMailMailIDBadRequest struct {
	Payload *models.BadRequest
}

func (o *PutCharactersCharacterIDMailMailIDBadRequest) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdBadRequest  %+v", 400, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDBadRequest) GetPayload() *models.BadRequest {
	return o.Payload
}

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

	o.Payload = new(models.BadRequest)

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

	return nil
}

func NewPutCharactersCharacterIDMailMailIDUnauthorized() *PutCharactersCharacterIDMailMailIDUnauthorized {
	return &PutCharactersCharacterIDMailMailIDUnauthorized{}
}

type PutCharactersCharacterIDMailMailIDUnauthorized struct {
	Payload *models.Unauthorized
}

func (o *PutCharactersCharacterIDMailMailIDUnauthorized) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdUnauthorized  %+v", 401, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDUnauthorized) GetPayload() *models.Unauthorized {
	return o.Payload
}

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

	o.Payload = new(models.Unauthorized)

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

	return nil
}

func NewPutCharactersCharacterIDMailMailIDForbidden() *PutCharactersCharacterIDMailMailIDForbidden {
	return &PutCharactersCharacterIDMailMailIDForbidden{}
}

type PutCharactersCharacterIDMailMailIDForbidden struct {
	Payload *models.Forbidden
}

func (o *PutCharactersCharacterIDMailMailIDForbidden) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdForbidden  %+v", 403, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDForbidden) GetPayload() *models.Forbidden {
	return o.Payload
}

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

	o.Payload = new(models.Forbidden)

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

	return nil
}

func NewPutCharactersCharacterIDMailMailIDEnhanceYourCalm() *PutCharactersCharacterIDMailMailIDEnhanceYourCalm {
	return &PutCharactersCharacterIDMailMailIDEnhanceYourCalm{}
}

type PutCharactersCharacterIDMailMailIDEnhanceYourCalm struct {
	Payload *models.ErrorLimited
}

func (o *PutCharactersCharacterIDMailMailIDEnhanceYourCalm) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdEnhanceYourCalm  %+v", 420, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDEnhanceYourCalm) GetPayload() *models.ErrorLimited {
	return o.Payload
}

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

	o.Payload = new(models.ErrorLimited)

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

	return nil
}

func NewPutCharactersCharacterIDMailMailIDInternalServerError() *PutCharactersCharacterIDMailMailIDInternalServerError {
	return &PutCharactersCharacterIDMailMailIDInternalServerError{}
}

type PutCharactersCharacterIDMailMailIDInternalServerError struct {
	Payload *models.InternalServerError
}

func (o *PutCharactersCharacterIDMailMailIDInternalServerError) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdInternalServerError  %+v", 500, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDInternalServerError) GetPayload() *models.InternalServerError {
	return o.Payload
}

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

	o.Payload = new(models.InternalServerError)

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

	return nil
}

func NewPutCharactersCharacterIDMailMailIDServiceUnavailable() *PutCharactersCharacterIDMailMailIDServiceUnavailable {
	return &PutCharactersCharacterIDMailMailIDServiceUnavailable{}
}

type PutCharactersCharacterIDMailMailIDServiceUnavailable struct {
	Payload *models.ServiceUnavailable
}

func (o *PutCharactersCharacterIDMailMailIDServiceUnavailable) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdServiceUnavailable  %+v", 503, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDServiceUnavailable) GetPayload() *models.ServiceUnavailable {
	return o.Payload
}

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

	o.Payload = new(models.ServiceUnavailable)

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

	return nil
}

func NewPutCharactersCharacterIDMailMailIDGatewayTimeout() *PutCharactersCharacterIDMailMailIDGatewayTimeout {
	return &PutCharactersCharacterIDMailMailIDGatewayTimeout{}
}

type PutCharactersCharacterIDMailMailIDGatewayTimeout struct {
	Payload *models.GatewayTimeout
}

func (o *PutCharactersCharacterIDMailMailIDGatewayTimeout) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdGatewayTimeout  %+v", 504, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDGatewayTimeout) GetPayload() *models.GatewayTimeout {
	return o.Payload
}

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

	o.Payload = new(models.GatewayTimeout)

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

	return nil
}

type PutCharactersCharacterIDMailMailIDBody struct {

	Labels []*int32 `json:"labels"`

	Read bool `json:"read,omitempty"`
}

func (o *PutCharactersCharacterIDMailMailIDBody) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateLabels(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *PutCharactersCharacterIDMailMailIDBody) validateLabels(formats strfmt.Registry) error {
	if swag.IsZero(o.Labels) { 
		return nil
	}

	iLabelsSize := int64(len(o.Labels))

	if err := validate.MaxItems("contents"+"."+"labels", "body", iLabelsSize, 25); err != nil {
		return err
	}

	for i := 0; i < len(o.Labels); i++ {
		if swag.IsZero(o.Labels[i]) { 
			continue
		}

		if err := validate.MinimumInt("contents"+"."+"labels"+"."+strconv.Itoa(i), "body", int64(*o.Labels[i]), 0, false); err != nil {
			return err
		}

	}

	return nil
}

func (o *PutCharactersCharacterIDMailMailIDBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

func (o *PutCharactersCharacterIDMailMailIDBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

func (o *PutCharactersCharacterIDMailMailIDBody) UnmarshalBinary(b []byte) error {
	var res PutCharactersCharacterIDMailMailIDBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}
// Code generated by go-swagger; DO NOT EDIT.

package mail

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"
	"fmt"
	"io"
	"strconv"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"

	"github.com/ferocious-space/eveapi/models"
)

// PutCharactersCharacterIDMailMailIDReader is a Reader for the PutCharactersCharacterIDMailMailID structure.
type PutCharactersCharacterIDMailMailIDReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutCharactersCharacterIDMailMailIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 204:
		result := NewPutCharactersCharacterIDMailMailIDNoContent()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutCharactersCharacterIDMailMailIDBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPutCharactersCharacterIDMailMailIDUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutCharactersCharacterIDMailMailIDForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 420:
		result := NewPutCharactersCharacterIDMailMailIDEnhanceYourCalm()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutCharactersCharacterIDMailMailIDInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPutCharactersCharacterIDMailMailIDServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 504:
		result := NewPutCharactersCharacterIDMailMailIDGatewayTimeout()
		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())
	}
}

// NewPutCharactersCharacterIDMailMailIDNoContent creates a PutCharactersCharacterIDMailMailIDNoContent with default headers values
func NewPutCharactersCharacterIDMailMailIDNoContent() *PutCharactersCharacterIDMailMailIDNoContent {
	return &PutCharactersCharacterIDMailMailIDNoContent{}
}

/* PutCharactersCharacterIDMailMailIDNoContent describes a response with status code 204, with default header values.

Mail updated
*/
type PutCharactersCharacterIDMailMailIDNoContent struct {
}

func (o *PutCharactersCharacterIDMailMailIDNoContent) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdNoContent ", 204)
}

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

	return nil
}

// NewPutCharactersCharacterIDMailMailIDBadRequest creates a PutCharactersCharacterIDMailMailIDBadRequest with default headers values
func NewPutCharactersCharacterIDMailMailIDBadRequest() *PutCharactersCharacterIDMailMailIDBadRequest {
	return &PutCharactersCharacterIDMailMailIDBadRequest{}
}

/* PutCharactersCharacterIDMailMailIDBadRequest describes a response with status code 400, with default header values.

Bad request
*/
type PutCharactersCharacterIDMailMailIDBadRequest struct {
	Payload *models.BadRequest
}

func (o *PutCharactersCharacterIDMailMailIDBadRequest) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdBadRequest  %+v", 400, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDBadRequest) GetPayload() *models.BadRequest {
	return o.Payload
}

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

	o.Payload = new(models.BadRequest)

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

	return nil
}

// NewPutCharactersCharacterIDMailMailIDUnauthorized creates a PutCharactersCharacterIDMailMailIDUnauthorized with default headers values
func NewPutCharactersCharacterIDMailMailIDUnauthorized() *PutCharactersCharacterIDMailMailIDUnauthorized {
	return &PutCharactersCharacterIDMailMailIDUnauthorized{}
}

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

Unauthorized
*/
type PutCharactersCharacterIDMailMailIDUnauthorized struct {
	Payload *models.Unauthorized
}

func (o *PutCharactersCharacterIDMailMailIDUnauthorized) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdUnauthorized  %+v", 401, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDUnauthorized) GetPayload() *models.Unauthorized {
	return o.Payload
}

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

	o.Payload = new(models.Unauthorized)

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

	return nil
}

// NewPutCharactersCharacterIDMailMailIDForbidden creates a PutCharactersCharacterIDMailMailIDForbidden with default headers values
func NewPutCharactersCharacterIDMailMailIDForbidden() *PutCharactersCharacterIDMailMailIDForbidden {
	return &PutCharactersCharacterIDMailMailIDForbidden{}
}

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

Forbidden
*/
type PutCharactersCharacterIDMailMailIDForbidden struct {
	Payload *models.Forbidden
}

func (o *PutCharactersCharacterIDMailMailIDForbidden) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdForbidden  %+v", 403, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDForbidden) GetPayload() *models.Forbidden {
	return o.Payload
}

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

	o.Payload = new(models.Forbidden)

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

	return nil
}

// NewPutCharactersCharacterIDMailMailIDEnhanceYourCalm creates a PutCharactersCharacterIDMailMailIDEnhanceYourCalm with default headers values
func NewPutCharactersCharacterIDMailMailIDEnhanceYourCalm() *PutCharactersCharacterIDMailMailIDEnhanceYourCalm {
	return &PutCharactersCharacterIDMailMailIDEnhanceYourCalm{}
}

/* PutCharactersCharacterIDMailMailIDEnhanceYourCalm describes a response with status code 420, with default header values.

Error limited
*/
type PutCharactersCharacterIDMailMailIDEnhanceYourCalm struct {
	Payload *models.ErrorLimited
}

func (o *PutCharactersCharacterIDMailMailIDEnhanceYourCalm) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdEnhanceYourCalm  %+v", 420, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDEnhanceYourCalm) GetPayload() *models.ErrorLimited {
	return o.Payload
}

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

	o.Payload = new(models.ErrorLimited)

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

	return nil
}

// NewPutCharactersCharacterIDMailMailIDInternalServerError creates a PutCharactersCharacterIDMailMailIDInternalServerError with default headers values
func NewPutCharactersCharacterIDMailMailIDInternalServerError() *PutCharactersCharacterIDMailMailIDInternalServerError {
	return &PutCharactersCharacterIDMailMailIDInternalServerError{}
}

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

Internal server error
*/
type PutCharactersCharacterIDMailMailIDInternalServerError struct {
	Payload *models.InternalServerError
}

func (o *PutCharactersCharacterIDMailMailIDInternalServerError) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdInternalServerError  %+v", 500, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDInternalServerError) GetPayload() *models.InternalServerError {
	return o.Payload
}

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

	o.Payload = new(models.InternalServerError)

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

	return nil
}

// NewPutCharactersCharacterIDMailMailIDServiceUnavailable creates a PutCharactersCharacterIDMailMailIDServiceUnavailable with default headers values
func NewPutCharactersCharacterIDMailMailIDServiceUnavailable() *PutCharactersCharacterIDMailMailIDServiceUnavailable {
	return &PutCharactersCharacterIDMailMailIDServiceUnavailable{}
}

/* PutCharactersCharacterIDMailMailIDServiceUnavailable describes a response with status code 503, with default header values.

Service unavailable
*/
type PutCharactersCharacterIDMailMailIDServiceUnavailable struct {
	Payload *models.ServiceUnavailable
}

func (o *PutCharactersCharacterIDMailMailIDServiceUnavailable) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdServiceUnavailable  %+v", 503, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDServiceUnavailable) GetPayload() *models.ServiceUnavailable {
	return o.Payload
}

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

	o.Payload = new(models.ServiceUnavailable)

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

	return nil
}

// NewPutCharactersCharacterIDMailMailIDGatewayTimeout creates a PutCharactersCharacterIDMailMailIDGatewayTimeout with default headers values
func NewPutCharactersCharacterIDMailMailIDGatewayTimeout() *PutCharactersCharacterIDMailMailIDGatewayTimeout {
	return &PutCharactersCharacterIDMailMailIDGatewayTimeout{}
}

/* PutCharactersCharacterIDMailMailIDGatewayTimeout describes a response with status code 504, with default header values.

Gateway timeout
*/
type PutCharactersCharacterIDMailMailIDGatewayTimeout struct {
	Payload *models.GatewayTimeout
}

func (o *PutCharactersCharacterIDMailMailIDGatewayTimeout) Error() string {
	return fmt.Sprintf("[PUT /v1/characters/{character_id}/mail/{mail_id}/][%d] putCharactersCharacterIdMailMailIdGatewayTimeout  %+v", 504, o.Payload)
}
func (o *PutCharactersCharacterIDMailMailIDGatewayTimeout) GetPayload() *models.GatewayTimeout {
	return o.Payload
}

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

	o.Payload = new(models.GatewayTimeout)

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

	return nil
}

/*PutCharactersCharacterIDMailMailIDBody put_characters_character_id_mail_mail_id_contents
//
// contents object
swagger:model PutCharactersCharacterIDMailMailIDBody
*/
type PutCharactersCharacterIDMailMailIDBody struct {

	// put_characters_character_id_mail_mail_id_labels
	//
	// Labels to assign to the mail. Pre-existing labels are unassigned.
	// Max Items: 25
	Labels []*int32 `json:"labels"`

	// put_characters_character_id_mail_mail_id_read
	//
	// Whether the mail is flagged as read
	Read bool `json:"read,omitempty"`
}

// Validate validates this put characters character ID mail mail ID body
func (o *PutCharactersCharacterIDMailMailIDBody) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateLabels(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *PutCharactersCharacterIDMailMailIDBody) validateLabels(formats strfmt.Registry) error {
	if swag.IsZero(o.Labels) { // not required
		return nil
	}

	iLabelsSize := int64(len(o.Labels))

	if err := validate.MaxItems("contents"+"."+"labels", "body", iLabelsSize, 25); err != nil {
		return err
	}

	for i := 0; i < len(o.Labels); i++ {
		if swag.IsZero(o.Labels[i]) { // not required
			continue
		}

		if err := validate.MinimumInt("contents"+"."+"labels"+"."+strconv.Itoa(i), "body", int64(*o.Labels[i]), 0, false); err != nil {
			return err
		}

	}

	return nil
}

// ContextValidate validates this put characters character ID mail mail ID body based on context it is used
func (o *PutCharactersCharacterIDMailMailIDBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *PutCharactersCharacterIDMailMailIDBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *PutCharactersCharacterIDMailMailIDBody) UnmarshalBinary(b []byte) error {
	var res PutCharactersCharacterIDMailMailIDBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}
