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

package controller_info

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"encoding/json"
	"fmt"
	"io"

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

	apiserver_params "github.com/cloudbase/garm/apiserver/params"
	garm_params "github.com/cloudbase/garm/params"
)

// ControllerInfoReader is a Reader for the ControllerInfo structure.
type ControllerInfoReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ControllerInfoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewControllerInfoOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 409:
		result := NewControllerInfoConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /controller-info] ControllerInfo", response, response.Code())
	}
}

// NewControllerInfoOK creates a ControllerInfoOK with default headers values
func NewControllerInfoOK() *ControllerInfoOK {
	return &ControllerInfoOK{}
}

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

ControllerInfo
*/
type ControllerInfoOK struct {
	Payload garm_params.ControllerInfo
}

// IsSuccess returns true when this controller info o k response has a 2xx status code
func (o *ControllerInfoOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this controller info o k response has a 3xx status code
func (o *ControllerInfoOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this controller info o k response has a 4xx status code
func (o *ControllerInfoOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this controller info o k response has a 5xx status code
func (o *ControllerInfoOK) IsServerError() bool {
	return false
}

// IsCode returns true when this controller info o k response a status code equal to that given
func (o *ControllerInfoOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the controller info o k response
func (o *ControllerInfoOK) Code() int {
	return 200
}

func (o *ControllerInfoOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /controller-info][%d] controllerInfoOK %s", 200, payload)
}

func (o *ControllerInfoOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /controller-info][%d] controllerInfoOK %s", 200, payload)
}

func (o *ControllerInfoOK) GetPayload() garm_params.ControllerInfo {
	return o.Payload
}

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

// NewControllerInfoConflict creates a ControllerInfoConflict with default headers values
func NewControllerInfoConflict() *ControllerInfoConflict {
	return &ControllerInfoConflict{}
}

/*
ControllerInfoConflict describes a response with status code 409, with default header values.

APIErrorResponse
*/
type ControllerInfoConflict struct {
	Payload apiserver_params.APIErrorResponse
}

// IsSuccess returns true when this controller info conflict response has a 2xx status code
func (o *ControllerInfoConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this controller info conflict response has a 3xx status code
func (o *ControllerInfoConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this controller info conflict response has a 4xx status code
func (o *ControllerInfoConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this controller info conflict response has a 5xx status code
func (o *ControllerInfoConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this controller info conflict response a status code equal to that given
func (o *ControllerInfoConflict) IsCode(code int) bool {
	return code == 409
}

// Code gets the status code for the controller info conflict response
func (o *ControllerInfoConflict) Code() int {
	return 409
}

func (o *ControllerInfoConflict) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /controller-info][%d] controllerInfoConflict %s", 409, payload)
}

func (o *ControllerInfoConflict) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /controller-info][%d] controllerInfoConflict %s", 409, payload)
}

func (o *ControllerInfoConflict) GetPayload() apiserver_params.APIErrorResponse {
	return o.Payload
}

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