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

package user

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

import (
	"encoding/json"
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/grafana/grafana-openapi-client-go/models"
)

// UpdateUserEmailReader is a Reader for the UpdateUserEmail structure.
type UpdateUserEmailReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UpdateUserEmailReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 302:
		result := NewUpdateUserEmailFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /user/email/update] updateUserEmail", response, response.Code())
	}
}

// NewUpdateUserEmailFound creates a UpdateUserEmailFound with default headers values
func NewUpdateUserEmailFound() *UpdateUserEmailFound {
	return &UpdateUserEmailFound{}
}

/*
UpdateUserEmailFound describes a response with status code 302, with default header values.

An OKResponse is returned if the request was successful.
*/
type UpdateUserEmailFound struct {
	Payload *models.SuccessResponseBody
}

// IsSuccess returns true when this update user email found response has a 2xx status code
func (o *UpdateUserEmailFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this update user email found response has a 3xx status code
func (o *UpdateUserEmailFound) IsRedirect() bool {
	return true
}

// IsClientError returns true when this update user email found response has a 4xx status code
func (o *UpdateUserEmailFound) IsClientError() bool {
	return false
}

// IsServerError returns true when this update user email found response has a 5xx status code
func (o *UpdateUserEmailFound) IsServerError() bool {
	return false
}

// IsCode returns true when this update user email found response a status code equal to that given
func (o *UpdateUserEmailFound) IsCode(code int) bool {
	return code == 302
}

// Code gets the status code for the update user email found response
func (o *UpdateUserEmailFound) Code() int {
	return 302
}

func (o *UpdateUserEmailFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /user/email/update][%d] updateUserEmailFound %s", 302, payload)
}

func (o *UpdateUserEmailFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /user/email/update][%d] updateUserEmailFound %s", 302, payload)
}

func (o *UpdateUserEmailFound) GetPayload() *models.SuccessResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.SuccessResponseBody)

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

	return nil
}
