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

package issue

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

// IssueEditIssueReader is a Reader for the IssueEditIssue structure.
type IssueEditIssueReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *IssueEditIssueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewIssueEditIssueCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewIssueEditIssueForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewIssueEditIssueNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 412:
		result := NewIssueEditIssuePreconditionFailed()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PATCH /repos/{owner}/{repo}/issues/{index}] issueEditIssue", response, response.Code())
	}
}

// NewIssueEditIssueCreated creates a IssueEditIssueCreated with default headers values
func NewIssueEditIssueCreated() *IssueEditIssueCreated {
	return &IssueEditIssueCreated{}
}

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

Issue
*/
type IssueEditIssueCreated struct {
	Payload *models.Issue
}

// IsSuccess returns true when this issue edit issue created response has a 2xx status code
func (o *IssueEditIssueCreated) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this issue edit issue created response has a 3xx status code
func (o *IssueEditIssueCreated) IsRedirect() bool {
	return false
}

// IsClientError returns true when this issue edit issue created response has a 4xx status code
func (o *IssueEditIssueCreated) IsClientError() bool {
	return false
}

// IsServerError returns true when this issue edit issue created response has a 5xx status code
func (o *IssueEditIssueCreated) IsServerError() bool {
	return false
}

// IsCode returns true when this issue edit issue created response a status code equal to that given
func (o *IssueEditIssueCreated) IsCode(code int) bool {
	return code == 201
}

// Code gets the status code for the issue edit issue created response
func (o *IssueEditIssueCreated) Code() int {
	return 201
}

func (o *IssueEditIssueCreated) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /repos/{owner}/{repo}/issues/{index}][%d] issueEditIssueCreated %s", 201, payload)
}

func (o *IssueEditIssueCreated) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /repos/{owner}/{repo}/issues/{index}][%d] issueEditIssueCreated %s", 201, payload)
}

func (o *IssueEditIssueCreated) GetPayload() *models.Issue {
	return o.Payload
}

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

	o.Payload = new(models.Issue)

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

	return nil
}

// NewIssueEditIssueForbidden creates a IssueEditIssueForbidden with default headers values
func NewIssueEditIssueForbidden() *IssueEditIssueForbidden {
	return &IssueEditIssueForbidden{}
}

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

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

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

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

// IsClientError returns true when this issue edit issue forbidden response has a 4xx status code
func (o *IssueEditIssueForbidden) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the issue edit issue forbidden response
func (o *IssueEditIssueForbidden) Code() int {
	return 403
}

func (o *IssueEditIssueForbidden) Error() string {
	return fmt.Sprintf("[PATCH /repos/{owner}/{repo}/issues/{index}][%d] issueEditIssueForbidden", 403)
}

func (o *IssueEditIssueForbidden) String() string {
	return fmt.Sprintf("[PATCH /repos/{owner}/{repo}/issues/{index}][%d] issueEditIssueForbidden", 403)
}

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

// NewIssueEditIssueNotFound creates a IssueEditIssueNotFound with default headers values
func NewIssueEditIssueNotFound() *IssueEditIssueNotFound {
	return &IssueEditIssueNotFound{}
}

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

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

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

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

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

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

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

// Code gets the status code for the issue edit issue not found response
func (o *IssueEditIssueNotFound) Code() int {
	return 404
}

func (o *IssueEditIssueNotFound) Error() string {
	return fmt.Sprintf("[PATCH /repos/{owner}/{repo}/issues/{index}][%d] issueEditIssueNotFound", 404)
}

func (o *IssueEditIssueNotFound) String() string {
	return fmt.Sprintf("[PATCH /repos/{owner}/{repo}/issues/{index}][%d] issueEditIssueNotFound", 404)
}

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

	return nil
}

// NewIssueEditIssuePreconditionFailed creates a IssueEditIssuePreconditionFailed with default headers values
func NewIssueEditIssuePreconditionFailed() *IssueEditIssuePreconditionFailed {
	return &IssueEditIssuePreconditionFailed{}
}

/*
IssueEditIssuePreconditionFailed describes a response with status code 412, with default header values.

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

// IsSuccess returns true when this issue edit issue precondition failed response has a 2xx status code
func (o *IssueEditIssuePreconditionFailed) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this issue edit issue precondition failed response has a 3xx status code
func (o *IssueEditIssuePreconditionFailed) IsRedirect() bool {
	return false
}

// IsClientError returns true when this issue edit issue precondition failed response has a 4xx status code
func (o *IssueEditIssuePreconditionFailed) IsClientError() bool {
	return true
}

// IsServerError returns true when this issue edit issue precondition failed response has a 5xx status code
func (o *IssueEditIssuePreconditionFailed) IsServerError() bool {
	return false
}

// IsCode returns true when this issue edit issue precondition failed response a status code equal to that given
func (o *IssueEditIssuePreconditionFailed) IsCode(code int) bool {
	return code == 412
}

// Code gets the status code for the issue edit issue precondition failed response
func (o *IssueEditIssuePreconditionFailed) Code() int {
	return 412
}

func (o *IssueEditIssuePreconditionFailed) Error() string {
	return fmt.Sprintf("[PATCH /repos/{owner}/{repo}/issues/{index}][%d] issueEditIssuePreconditionFailed", 412)
}

func (o *IssueEditIssuePreconditionFailed) String() string {
	return fmt.Sprintf("[PATCH /repos/{owner}/{repo}/issues/{index}][%d] issueEditIssuePreconditionFailed", 412)
}

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