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

package public

// 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/ory/hydra-client-go/models"
)

// UserinfoReader is a Reader for the Userinfo structure.
type UserinfoReader struct {
	formats strfmt.Registry
}

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

// NewUserinfoOK creates a UserinfoOK with default headers values
func NewUserinfoOK() *UserinfoOK {
	return &UserinfoOK{}
}

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

userinfoResponse
*/
type UserinfoOK struct {
	Payload *models.UserinfoResponse
}

func (o *UserinfoOK) Error() string {
	return fmt.Sprintf("[GET /userinfo][%d] userinfoOK  %+v", 200, o.Payload)
}
func (o *UserinfoOK) GetPayload() *models.UserinfoResponse {
	return o.Payload
}

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

	o.Payload = new(models.UserinfoResponse)

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

	return nil
}

// NewUserinfoUnauthorized creates a UserinfoUnauthorized with default headers values
func NewUserinfoUnauthorized() *UserinfoUnauthorized {
	return &UserinfoUnauthorized{}
}

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

jsonError
*/
type UserinfoUnauthorized struct {
	Payload *models.JSONError
}

func (o *UserinfoUnauthorized) Error() string {
	return fmt.Sprintf("[GET /userinfo][%d] userinfoUnauthorized  %+v", 401, o.Payload)
}
func (o *UserinfoUnauthorized) GetPayload() *models.JSONError {
	return o.Payload
}

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

	o.Payload = new(models.JSONError)

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

	return nil
}

// NewUserinfoInternalServerError creates a UserinfoInternalServerError with default headers values
func NewUserinfoInternalServerError() *UserinfoInternalServerError {
	return &UserinfoInternalServerError{}
}

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

jsonError
*/
type UserinfoInternalServerError struct {
	Payload *models.JSONError
}

func (o *UserinfoInternalServerError) Error() string {
	return fmt.Sprintf("[GET /userinfo][%d] userinfoInternalServerError  %+v", 500, o.Payload)
}
func (o *UserinfoInternalServerError) GetPayload() *models.JSONError {
	return o.Payload
}

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

	o.Payload = new(models.JSONError)

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

	return nil
}
