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

// RepoTransferReader is a Reader for the RepoTransfer structure.
type RepoTransferReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RepoTransferReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 202:
		result := NewRepoTransferAccepted()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewRepoTransferForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewRepoTransferNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewRepoTransferUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /repos/{owner}/{repo}/transfer] repoTransfer", response, response.Code())
	}
}

// NewRepoTransferAccepted creates a RepoTransferAccepted with default headers values
func NewRepoTransferAccepted() *RepoTransferAccepted {
	return &RepoTransferAccepted{}
}

/*
RepoTransferAccepted describes a response with status code 202, with default header values.

Repository
*/
type RepoTransferAccepted struct {
	Payload *models.Repository
}

// IsSuccess returns true when this repo transfer accepted response has a 2xx status code
func (o *RepoTransferAccepted) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this repo transfer accepted response has a 3xx status code
func (o *RepoTransferAccepted) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo transfer accepted response has a 4xx status code
func (o *RepoTransferAccepted) IsClientError() bool {
	return false
}

// IsServerError returns true when this repo transfer accepted response has a 5xx status code
func (o *RepoTransferAccepted) IsServerError() bool {
	return false
}

// IsCode returns true when this repo transfer accepted response a status code equal to that given
func (o *RepoTransferAccepted) IsCode(code int) bool {
	return code == 202
}

// Code gets the status code for the repo transfer accepted response
func (o *RepoTransferAccepted) Code() int {
	return 202
}

func (o *RepoTransferAccepted) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer][%d] repoTransferAccepted %s", 202, payload)
}

func (o *RepoTransferAccepted) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer][%d] repoTransferAccepted %s", 202, payload)
}

func (o *RepoTransferAccepted) GetPayload() *models.Repository {
	return o.Payload
}

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

	o.Payload = new(models.Repository)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewRepoTransferForbidden creates a RepoTransferForbidden with default headers values
func NewRepoTransferForbidden() *RepoTransferForbidden {
	return &RepoTransferForbidden{}
}

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

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

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

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

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

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

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

// Code gets the status code for the repo transfer forbidden response
func (o *RepoTransferForbidden) Code() int {
	return 403
}

func (o *RepoTransferForbidden) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer][%d] repoTransferForbidden", 403)
}

func (o *RepoTransferForbidden) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer][%d] repoTransferForbidden", 403)
}

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

// NewRepoTransferNotFound creates a RepoTransferNotFound with default headers values
func NewRepoTransferNotFound() *RepoTransferNotFound {
	return &RepoTransferNotFound{}
}

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

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

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

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

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

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

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

// Code gets the status code for the repo transfer not found response
func (o *RepoTransferNotFound) Code() int {
	return 404
}

func (o *RepoTransferNotFound) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer][%d] repoTransferNotFound", 404)
}

func (o *RepoTransferNotFound) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer][%d] repoTransferNotFound", 404)
}

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

	return nil
}

// NewRepoTransferUnprocessableEntity creates a RepoTransferUnprocessableEntity with default headers values
func NewRepoTransferUnprocessableEntity() *RepoTransferUnprocessableEntity {
	return &RepoTransferUnprocessableEntity{}
}

/*
RepoTransferUnprocessableEntity describes a response with status code 422, with default header values.

APIValidationError is error format response related to input validation
*/
type RepoTransferUnprocessableEntity struct {
	Message string
	URL     string
}

// IsSuccess returns true when this repo transfer unprocessable entity response has a 2xx status code
func (o *RepoTransferUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo transfer unprocessable entity response has a 3xx status code
func (o *RepoTransferUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo transfer unprocessable entity response has a 4xx status code
func (o *RepoTransferUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo transfer unprocessable entity response has a 5xx status code
func (o *RepoTransferUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this repo transfer unprocessable entity response a status code equal to that given
func (o *RepoTransferUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the repo transfer unprocessable entity response
func (o *RepoTransferUnprocessableEntity) Code() int {
	return 422
}

func (o *RepoTransferUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer][%d] repoTransferUnprocessableEntity", 422)
}

func (o *RepoTransferUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/transfer][%d] repoTransferUnprocessableEntity", 422)
}

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