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

// DownloadModelDefinitionReader is a Reader for the DownloadModelDefinition structure.
type DownloadModelDefinitionReader struct {
	formats strfmt.Registry
	writer  io.Writer
}

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

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

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

	case 404:
		result := NewDownloadModelDefinitionNotFound()
		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())
	}
}

// NewDownloadModelDefinitionOK creates a DownloadModelDefinitionOK with default headers values
func NewDownloadModelDefinitionOK(writer io.Writer) *DownloadModelDefinitionOK {
	return &DownloadModelDefinitionOK{
		Payload: writer,
	}
}

/*DownloadModelDefinitionOK handles this case with default header values.

Model definition
*/
type DownloadModelDefinitionOK struct {
	Payload io.Writer
}

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

func (o *DownloadModelDefinitionOK) 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
}

// NewDownloadModelDefinitionUnauthorized creates a DownloadModelDefinitionUnauthorized with default headers values
func NewDownloadModelDefinitionUnauthorized() *DownloadModelDefinitionUnauthorized {
	return &DownloadModelDefinitionUnauthorized{}
}

/*DownloadModelDefinitionUnauthorized handles this case with default header values.

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

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

func (o *DownloadModelDefinitionUnauthorized) 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
}

// NewDownloadModelDefinitionNotFound creates a DownloadModelDefinitionNotFound with default headers values
func NewDownloadModelDefinitionNotFound() *DownloadModelDefinitionNotFound {
	return &DownloadModelDefinitionNotFound{}
}

/*DownloadModelDefinitionNotFound handles this case with default header values.

The model cannot be found.
*/
type DownloadModelDefinitionNotFound struct {
	Payload *restmodels.Error
}

func (o *DownloadModelDefinitionNotFound) Error() string {
	return fmt.Sprintf("[GET /v1/models/{model_id}/definition][%d] downloadModelDefinitionNotFound  %+v", 404, o.Payload)
}

func (o *DownloadModelDefinitionNotFound) 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
}
