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

package models

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

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

	"github.com/IBM/FfDL/restapi/api_v1/restmodels"
)

// ListModelsReader is a Reader for the ListModels structure.
type ListModelsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ListModelsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {

	case 200:
		result := NewListModelsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil

	case 401:
		result := NewListModelsUnauthorized()
		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())
	}
}

// NewListModelsOK creates a ListModelsOK with default headers values
func NewListModelsOK() *ListModelsOK {
	return &ListModelsOK{}
}

/*ListModelsOK handles this case with default header values.

List of deep learning models.
*/
type ListModelsOK struct {
	Payload *restmodels.ModelList
}

func (o *ListModelsOK) Error() string {
	return fmt.Sprintf("[GET /v1/models][%d] listModelsOK  %+v", 200, o.Payload)
}

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

	o.Payload = new(restmodels.ModelList)

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

	return nil
}

// NewListModelsUnauthorized creates a ListModelsUnauthorized with default headers values
func NewListModelsUnauthorized() *ListModelsUnauthorized {
	return &ListModelsUnauthorized{}
}

/*ListModelsUnauthorized handles this case with default header values.

Unauthorized
*/
type ListModelsUnauthorized struct {
	Payload *restmodels.Error
}

func (o *ListModelsUnauthorized) Error() string {
	return fmt.Sprintf("[GET /v1/models][%d] listModelsUnauthorized  %+v", 401, o.Payload)
}

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

	o.Payload = new(restmodels.Error)

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

	return nil
}
