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

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

// GetUserByEmailReader is a Reader for the GetUserByEmail structure.
type GetUserByEmailReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetUserByEmailReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetUserByEmailOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetUserByEmailUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetUserByEmailForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetUserByEmailNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetUserByEmailInternalServerError()
		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())
	}
}

// NewGetUserByEmailOK creates a GetUserByEmailOK with default headers values
func NewGetUserByEmailOK() *GetUserByEmailOK {
	return &GetUserByEmailOK{}
}

/*GetUserByEmailOK handles this case with default header values.

Taxnexus Response with User objects
*/
type GetUserByEmailOK struct {
	Payload []*auth0_models.User
}

func (o *GetUserByEmailOK) Error() string {
	return fmt.Sprintf("[GET /api/v2/users-by-email][%d] getUserByEmailOK  %+v", 200, o.Payload)
}

func (o *GetUserByEmailOK) GetPayload() []*auth0_models.User {
	return o.Payload
}

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

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

	return nil
}

// NewGetUserByEmailUnauthorized creates a GetUserByEmailUnauthorized with default headers values
func NewGetUserByEmailUnauthorized() *GetUserByEmailUnauthorized {
	return &GetUserByEmailUnauthorized{}
}

/*GetUserByEmailUnauthorized handles this case with default header values.

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

func (o *GetUserByEmailUnauthorized) Error() string {
	return fmt.Sprintf("[GET /api/v2/users-by-email][%d] getUserByEmailUnauthorized  %+v", 401, o.Payload)
}

func (o *GetUserByEmailUnauthorized) GetPayload() *auth0_models.Error {
	return o.Payload
}

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

	o.Payload = new(auth0_models.Error)

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

	return nil
}

// NewGetUserByEmailForbidden creates a GetUserByEmailForbidden with default headers values
func NewGetUserByEmailForbidden() *GetUserByEmailForbidden {
	return &GetUserByEmailForbidden{}
}

/*GetUserByEmailForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type GetUserByEmailForbidden struct {
	Payload *auth0_models.Error
}

func (o *GetUserByEmailForbidden) Error() string {
	return fmt.Sprintf("[GET /api/v2/users-by-email][%d] getUserByEmailForbidden  %+v", 403, o.Payload)
}

func (o *GetUserByEmailForbidden) GetPayload() *auth0_models.Error {
	return o.Payload
}

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

	o.Payload = new(auth0_models.Error)

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

	return nil
}

// NewGetUserByEmailNotFound creates a GetUserByEmailNotFound with default headers values
func NewGetUserByEmailNotFound() *GetUserByEmailNotFound {
	return &GetUserByEmailNotFound{}
}

/*GetUserByEmailNotFound handles this case with default header values.

Resource was not found
*/
type GetUserByEmailNotFound struct {
	Payload *auth0_models.Error
}

func (o *GetUserByEmailNotFound) Error() string {
	return fmt.Sprintf("[GET /api/v2/users-by-email][%d] getUserByEmailNotFound  %+v", 404, o.Payload)
}

func (o *GetUserByEmailNotFound) GetPayload() *auth0_models.Error {
	return o.Payload
}

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

	o.Payload = new(auth0_models.Error)

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

	return nil
}

// NewGetUserByEmailInternalServerError creates a GetUserByEmailInternalServerError with default headers values
func NewGetUserByEmailInternalServerError() *GetUserByEmailInternalServerError {
	return &GetUserByEmailInternalServerError{}
}

/*GetUserByEmailInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetUserByEmailInternalServerError struct {
	Payload *auth0_models.Error
}

func (o *GetUserByEmailInternalServerError) Error() string {
	return fmt.Sprintf("[GET /api/v2/users-by-email][%d] getUserByEmailInternalServerError  %+v", 500, o.Payload)
}

func (o *GetUserByEmailInternalServerError) GetPayload() *auth0_models.Error {
	return o.Payload
}

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

	o.Payload = new(auth0_models.Error)

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

	return nil
}
