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

package repository

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

	"src.opensuse.org/autogits/common/gitea-generated/models"
)

// RepoListPushMirrorsReader is a Reader for the RepoListPushMirrors structure.
type RepoListPushMirrorsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RepoListPushMirrorsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewRepoListPushMirrorsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewRepoListPushMirrorsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewRepoListPushMirrorsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewRepoListPushMirrorsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /repos/{owner}/{repo}/push_mirrors] repoListPushMirrors", response, response.Code())
	}
}

// NewRepoListPushMirrorsOK creates a RepoListPushMirrorsOK with default headers values
func NewRepoListPushMirrorsOK() *RepoListPushMirrorsOK {
	return &RepoListPushMirrorsOK{}
}

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

PushMirrorList
*/
type RepoListPushMirrorsOK struct {
	Payload []*models.PushMirror
}

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

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

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

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

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

// Code gets the status code for the repo list push mirrors o k response
func (o *RepoListPushMirrorsOK) Code() int {
	return 200
}

func (o *RepoListPushMirrorsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/push_mirrors][%d] repoListPushMirrorsOK %s", 200, payload)
}

func (o *RepoListPushMirrorsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/push_mirrors][%d] repoListPushMirrorsOK %s", 200, payload)
}

func (o *RepoListPushMirrorsOK) GetPayload() []*models.PushMirror {
	return o.Payload
}

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

// NewRepoListPushMirrorsBadRequest creates a RepoListPushMirrorsBadRequest with default headers values
func NewRepoListPushMirrorsBadRequest() *RepoListPushMirrorsBadRequest {
	return &RepoListPushMirrorsBadRequest{}
}

/*
RepoListPushMirrorsBadRequest describes a response with status code 400, with default header values.

APIError is error format response
*/
type RepoListPushMirrorsBadRequest struct {
	Message string
	URL     string
}

// IsSuccess returns true when this repo list push mirrors bad request response has a 2xx status code
func (o *RepoListPushMirrorsBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo list push mirrors bad request response has a 3xx status code
func (o *RepoListPushMirrorsBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo list push mirrors bad request response has a 4xx status code
func (o *RepoListPushMirrorsBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo list push mirrors bad request response has a 5xx status code
func (o *RepoListPushMirrorsBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this repo list push mirrors bad request response a status code equal to that given
func (o *RepoListPushMirrorsBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the repo list push mirrors bad request response
func (o *RepoListPushMirrorsBadRequest) Code() int {
	return 400
}

func (o *RepoListPushMirrorsBadRequest) Error() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/push_mirrors][%d] repoListPushMirrorsBadRequest", 400)
}

func (o *RepoListPushMirrorsBadRequest) String() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/push_mirrors][%d] repoListPushMirrorsBadRequest", 400)
}

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

	// hydrates response header message
	hdrMessage := response.GetHeader("message")

	if hdrMessage != "" {
		o.Message = hdrMessage
	}

	// hydrates response header url
	hdrURL := response.GetHeader("url")

	if hdrURL != "" {
		o.URL = hdrURL
	}

	return nil
}

// NewRepoListPushMirrorsForbidden creates a RepoListPushMirrorsForbidden with default headers values
func NewRepoListPushMirrorsForbidden() *RepoListPushMirrorsForbidden {
	return &RepoListPushMirrorsForbidden{}
}

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

APIForbiddenError is a forbidden error response
*/
type RepoListPushMirrorsForbidden struct {
	Message string
	URL     string
}

// IsSuccess returns true when this repo list push mirrors forbidden response has a 2xx status code
func (o *RepoListPushMirrorsForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo list push mirrors forbidden response has a 3xx status code
func (o *RepoListPushMirrorsForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo list push mirrors forbidden response has a 4xx status code
func (o *RepoListPushMirrorsForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo list push mirrors forbidden response has a 5xx status code
func (o *RepoListPushMirrorsForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this repo list push mirrors forbidden response a status code equal to that given
func (o *RepoListPushMirrorsForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the repo list push mirrors forbidden response
func (o *RepoListPushMirrorsForbidden) Code() int {
	return 403
}

func (o *RepoListPushMirrorsForbidden) Error() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/push_mirrors][%d] repoListPushMirrorsForbidden", 403)
}

func (o *RepoListPushMirrorsForbidden) String() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/push_mirrors][%d] repoListPushMirrorsForbidden", 403)
}

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

	// hydrates response header message
	hdrMessage := response.GetHeader("message")

	if hdrMessage != "" {
		o.Message = hdrMessage
	}

	// hydrates response header url
	hdrURL := response.GetHeader("url")

	if hdrURL != "" {
		o.URL = hdrURL
	}

	return nil
}

// NewRepoListPushMirrorsNotFound creates a RepoListPushMirrorsNotFound with default headers values
func NewRepoListPushMirrorsNotFound() *RepoListPushMirrorsNotFound {
	return &RepoListPushMirrorsNotFound{}
}

/*
RepoListPushMirrorsNotFound describes a response with status code 404, with default header values.

APINotFound is a not found empty response
*/
type RepoListPushMirrorsNotFound struct {
}

// IsSuccess returns true when this repo list push mirrors not found response has a 2xx status code
func (o *RepoListPushMirrorsNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo list push mirrors not found response has a 3xx status code
func (o *RepoListPushMirrorsNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo list push mirrors not found response has a 4xx status code
func (o *RepoListPushMirrorsNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo list push mirrors not found response has a 5xx status code
func (o *RepoListPushMirrorsNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this repo list push mirrors not found response a status code equal to that given
func (o *RepoListPushMirrorsNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the repo list push mirrors not found response
func (o *RepoListPushMirrorsNotFound) Code() int {
	return 404
}

func (o *RepoListPushMirrorsNotFound) Error() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/push_mirrors][%d] repoListPushMirrorsNotFound", 404)
}

func (o *RepoListPushMirrorsNotFound) String() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/push_mirrors][%d] repoListPushMirrorsNotFound", 404)
}

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

	return nil
}
