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

package repository_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/030/n3dr/internal/app/n3dr/goswagger/models"
)

// GetRepositoriesReader is a Reader for the GetRepositories structure.
type GetRepositoriesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetRepositoriesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetRepositoriesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetRepositoriesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetRepositoriesForbidden()
		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())
	}
}

// NewGetRepositoriesOK creates a GetRepositoriesOK with default headers values
func NewGetRepositoriesOK() *GetRepositoriesOK {
	return &GetRepositoriesOK{}
}

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

Repositories list returned
*/
type GetRepositoriesOK struct {
	Payload []*models.AbstractAPIRepository
}

// IsSuccess returns true when this get repositories o k response has a 2xx status code
func (o *GetRepositoriesOK) IsSuccess() bool {
	return true
}

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

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

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

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

// Code gets the status code for the get repositories o k response
func (o *GetRepositoriesOK) Code() int {
	return 200
}

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

func (o *GetRepositoriesOK) String() string {
	return fmt.Sprintf("[GET /v1/repositorySettings][%d] getRepositoriesOK  %+v", 200, o.Payload)
}

func (o *GetRepositoriesOK) GetPayload() []*models.AbstractAPIRepository {
	return o.Payload
}

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

// NewGetRepositoriesUnauthorized creates a GetRepositoriesUnauthorized with default headers values
func NewGetRepositoriesUnauthorized() *GetRepositoriesUnauthorized {
	return &GetRepositoriesUnauthorized{}
}

/*
GetRepositoriesUnauthorized describes a response with status code 401, with default header values.

Authentication required
*/
type GetRepositoriesUnauthorized struct {
}

// IsSuccess returns true when this get repositories unauthorized response has a 2xx status code
func (o *GetRepositoriesUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get repositories unauthorized response has a 3xx status code
func (o *GetRepositoriesUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get repositories unauthorized response has a 4xx status code
func (o *GetRepositoriesUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this get repositories unauthorized response has a 5xx status code
func (o *GetRepositoriesUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this get repositories unauthorized response a status code equal to that given
func (o *GetRepositoriesUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the get repositories unauthorized response
func (o *GetRepositoriesUnauthorized) Code() int {
	return 401
}

func (o *GetRepositoriesUnauthorized) Error() string {
	return fmt.Sprintf("[GET /v1/repositorySettings][%d] getRepositoriesUnauthorized ", 401)
}

func (o *GetRepositoriesUnauthorized) String() string {
	return fmt.Sprintf("[GET /v1/repositorySettings][%d] getRepositoriesUnauthorized ", 401)
}

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

	return nil
}

// NewGetRepositoriesForbidden creates a GetRepositoriesForbidden with default headers values
func NewGetRepositoriesForbidden() *GetRepositoriesForbidden {
	return &GetRepositoriesForbidden{}
}

/*
GetRepositoriesForbidden describes a response with status code 403, with default header values.

Insufficient permissions
*/
type GetRepositoriesForbidden struct {
}

// IsSuccess returns true when this get repositories forbidden response has a 2xx status code
func (o *GetRepositoriesForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get repositories forbidden response has a 3xx status code
func (o *GetRepositoriesForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get repositories forbidden response has a 4xx status code
func (o *GetRepositoriesForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this get repositories forbidden response has a 5xx status code
func (o *GetRepositoriesForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this get repositories forbidden response a status code equal to that given
func (o *GetRepositoriesForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the get repositories forbidden response
func (o *GetRepositoriesForbidden) Code() int {
	return 403
}

func (o *GetRepositoriesForbidden) Error() string {
	return fmt.Sprintf("[GET /v1/repositorySettings][%d] getRepositoriesForbidden ", 403)
}

func (o *GetRepositoriesForbidden) String() string {
	return fmt.Sprintf("[GET /v1/repositorySettings][%d] getRepositoriesForbidden ", 403)
}

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

	return nil
}
