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

package credit_management

// 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/Cyclops-Labs/cyclops-4-hpc.git/services/credit-system/models"
)

// GetHistoryReader is a Reader for the GetHistory structure.
type GetHistoryReader struct {
	formats strfmt.Registry
}

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

// NewGetHistoryOK creates a GetHistoryOK with default headers values
func NewGetHistoryOK() *GetHistoryOK {
	return &GetHistoryOK{}
}

/*GetHistoryOK handles this case with default header values.

Credit status history of the account with the provided id
*/
type GetHistoryOK struct {
	Payload *models.CreditHistory
}

func (o *GetHistoryOK) Error() string {
	return fmt.Sprintf("[GET /history/{id}][%d] getHistoryOK  %+v", 200, o.Payload)
}

func (o *GetHistoryOK) GetPayload() *models.CreditHistory {
	return o.Payload
}

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

	o.Payload = new(models.CreditHistory)

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

	return nil
}

// NewGetHistoryNotFound creates a GetHistoryNotFound with default headers values
func NewGetHistoryNotFound() *GetHistoryNotFound {
	return &GetHistoryNotFound{}
}

/*GetHistoryNotFound handles this case with default header values.

The endpoint provided doesn't exist
*/
type GetHistoryNotFound struct {
	Payload *models.ErrorResponse
}

func (o *GetHistoryNotFound) Error() string {
	return fmt.Sprintf("[GET /history/{id}][%d] getHistoryNotFound  %+v", 404, o.Payload)
}

func (o *GetHistoryNotFound) GetPayload() *models.ErrorResponse {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponse)

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

	return nil
}

// NewGetHistoryInternalServerError creates a GetHistoryInternalServerError with default headers values
func NewGetHistoryInternalServerError() *GetHistoryInternalServerError {
	return &GetHistoryInternalServerError{}
}

/*GetHistoryInternalServerError handles this case with default header values.

Something unexpected happend, error raised
*/
type GetHistoryInternalServerError struct {
	Payload *models.ErrorResponse
}

func (o *GetHistoryInternalServerError) Error() string {
	return fmt.Sprintf("[GET /history/{id}][%d] getHistoryInternalServerError  %+v", 500, o.Payload)
}

func (o *GetHistoryInternalServerError) GetPayload() *models.ErrorResponse {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponse)

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

	return nil
}
