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

// RepoChangeFilesReader is a Reader for the RepoChangeFiles structure.
type RepoChangeFilesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RepoChangeFilesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewRepoChangeFilesCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewRepoChangeFilesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewRepoChangeFilesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewRepoChangeFilesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 423:
		result := NewRepoChangeFilesLocked()
		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}/contents] repoChangeFiles", response, response.Code())
	}
}

// NewRepoChangeFilesCreated creates a RepoChangeFilesCreated with default headers values
func NewRepoChangeFilesCreated() *RepoChangeFilesCreated {
	return &RepoChangeFilesCreated{}
}

/*
RepoChangeFilesCreated describes a response with status code 201, with default header values.

FilesResponse
*/
type RepoChangeFilesCreated struct {
	Payload *models.FilesResponse
}

// IsSuccess returns true when this repo change files created response has a 2xx status code
func (o *RepoChangeFilesCreated) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this repo change files created response has a 3xx status code
func (o *RepoChangeFilesCreated) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo change files created response has a 4xx status code
func (o *RepoChangeFilesCreated) IsClientError() bool {
	return false
}

// IsServerError returns true when this repo change files created response has a 5xx status code
func (o *RepoChangeFilesCreated) IsServerError() bool {
	return false
}

// IsCode returns true when this repo change files created response a status code equal to that given
func (o *RepoChangeFilesCreated) IsCode(code int) bool {
	return code == 201
}

// Code gets the status code for the repo change files created response
func (o *RepoChangeFilesCreated) Code() int {
	return 201
}

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

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

func (o *RepoChangeFilesCreated) GetPayload() *models.FilesResponse {
	return o.Payload
}

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

	o.Payload = new(models.FilesResponse)

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

	return nil
}

// NewRepoChangeFilesForbidden creates a RepoChangeFilesForbidden with default headers values
func NewRepoChangeFilesForbidden() *RepoChangeFilesForbidden {
	return &RepoChangeFilesForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewRepoChangeFilesNotFound creates a RepoChangeFilesNotFound with default headers values
func NewRepoChangeFilesNotFound() *RepoChangeFilesNotFound {
	return &RepoChangeFilesNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

	return nil
}

// NewRepoChangeFilesUnprocessableEntity creates a RepoChangeFilesUnprocessableEntity with default headers values
func NewRepoChangeFilesUnprocessableEntity() *RepoChangeFilesUnprocessableEntity {
	return &RepoChangeFilesUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewRepoChangeFilesLocked creates a RepoChangeFilesLocked with default headers values
func NewRepoChangeFilesLocked() *RepoChangeFilesLocked {
	return &RepoChangeFilesLocked{}
}

/*
RepoChangeFilesLocked describes a response with status code 423, with default header values.

APIRepoArchivedError is an error that is raised when an archived repo should be modified
*/
type RepoChangeFilesLocked struct {
	Message string
	URL     string
}

// IsSuccess returns true when this repo change files locked response has a 2xx status code
func (o *RepoChangeFilesLocked) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo change files locked response has a 3xx status code
func (o *RepoChangeFilesLocked) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo change files locked response has a 4xx status code
func (o *RepoChangeFilesLocked) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo change files locked response has a 5xx status code
func (o *RepoChangeFilesLocked) IsServerError() bool {
	return false
}

// IsCode returns true when this repo change files locked response a status code equal to that given
func (o *RepoChangeFilesLocked) IsCode(code int) bool {
	return code == 423
}

// Code gets the status code for the repo change files locked response
func (o *RepoChangeFilesLocked) Code() int {
	return 423
}

func (o *RepoChangeFilesLocked) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/contents][%d] repoChangeFilesLocked", 423)
}

func (o *RepoChangeFilesLocked) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/contents][%d] repoChangeFilesLocked", 423)
}

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