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

package repositories

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

// ListRepoScaleSetsReader is a Reader for the ListRepoScaleSets structure.
type ListRepoScaleSetsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ListRepoScaleSetsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewListRepoScaleSetsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	default:
		result := NewListRepoScaleSetsDefault(response.Code())
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		if response.Code()/100 == 2 {
			return result, nil
		}
		return nil, result
	}
}

// NewListRepoScaleSetsOK creates a ListRepoScaleSetsOK with default headers values
func NewListRepoScaleSetsOK() *ListRepoScaleSetsOK {
	return &ListRepoScaleSetsOK{}
}

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

ScaleSets
*/
type ListRepoScaleSetsOK struct {
	Payload garm_params.ScaleSets
}

// IsSuccess returns true when this list repo scale sets o k response has a 2xx status code
func (o *ListRepoScaleSetsOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this list repo scale sets o k response has a 3xx status code
func (o *ListRepoScaleSetsOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this list repo scale sets o k response has a 4xx status code
func (o *ListRepoScaleSetsOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this list repo scale sets o k response has a 5xx status code
func (o *ListRepoScaleSetsOK) IsServerError() bool {
	return false
}

// IsCode returns true when this list repo scale sets o k response a status code equal to that given
func (o *ListRepoScaleSetsOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the list repo scale sets o k response
func (o *ListRepoScaleSetsOK) Code() int {
	return 200
}

func (o *ListRepoScaleSetsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /repositories/{repoID}/scalesets][%d] listRepoScaleSetsOK %s", 200, payload)
}

func (o *ListRepoScaleSetsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /repositories/{repoID}/scalesets][%d] listRepoScaleSetsOK %s", 200, payload)
}

func (o *ListRepoScaleSetsOK) GetPayload() garm_params.ScaleSets {
	return o.Payload
}

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

// NewListRepoScaleSetsDefault creates a ListRepoScaleSetsDefault with default headers values
func NewListRepoScaleSetsDefault(code int) *ListRepoScaleSetsDefault {
	return &ListRepoScaleSetsDefault{
		_statusCode: code,
	}
}

/*
ListRepoScaleSetsDefault describes a response with status code -1, with default header values.

APIErrorResponse
*/
type ListRepoScaleSetsDefault struct {
	_statusCode int

	Payload apiserver_params.APIErrorResponse
}

// IsSuccess returns true when this list repo scale sets default response has a 2xx status code
func (o *ListRepoScaleSetsDefault) IsSuccess() bool {
	return o._statusCode/100 == 2
}

// IsRedirect returns true when this list repo scale sets default response has a 3xx status code
func (o *ListRepoScaleSetsDefault) IsRedirect() bool {
	return o._statusCode/100 == 3
}

// IsClientError returns true when this list repo scale sets default response has a 4xx status code
func (o *ListRepoScaleSetsDefault) IsClientError() bool {
	return o._statusCode/100 == 4
}

// IsServerError returns true when this list repo scale sets default response has a 5xx status code
func (o *ListRepoScaleSetsDefault) IsServerError() bool {
	return o._statusCode/100 == 5
}

// IsCode returns true when this list repo scale sets default response a status code equal to that given
func (o *ListRepoScaleSetsDefault) IsCode(code int) bool {
	return o._statusCode == code
}

// Code gets the status code for the list repo scale sets default response
func (o *ListRepoScaleSetsDefault) Code() int {
	return o._statusCode
}

func (o *ListRepoScaleSetsDefault) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /repositories/{repoID}/scalesets][%d] ListRepoScaleSets default %s", o._statusCode, payload)
}

func (o *ListRepoScaleSetsDefault) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /repositories/{repoID}/scalesets][%d] ListRepoScaleSets default %s", o._statusCode, payload)
}

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

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