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

// IssueCreateIssueDependenciesReader is a Reader for the IssueCreateIssueDependencies structure.
type IssueCreateIssueDependenciesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *IssueCreateIssueDependenciesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewIssueCreateIssueDependenciesCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 404:
		result := NewIssueCreateIssueDependenciesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 423:
		result := NewIssueCreateIssueDependenciesLocked()
		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}/issues/{index}/dependencies] issueCreateIssueDependencies", response, response.Code())
	}
}

// NewIssueCreateIssueDependenciesCreated creates a IssueCreateIssueDependenciesCreated with default headers values
func NewIssueCreateIssueDependenciesCreated() *IssueCreateIssueDependenciesCreated {
	return &IssueCreateIssueDependenciesCreated{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewIssueCreateIssueDependenciesNotFound creates a IssueCreateIssueDependenciesNotFound with default headers values
func NewIssueCreateIssueDependenciesNotFound() *IssueCreateIssueDependenciesNotFound {
	return &IssueCreateIssueDependenciesNotFound{}
}

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

the issue does not exist
*/
type IssueCreateIssueDependenciesNotFound struct {
}

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

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

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

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

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

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

func (o *IssueCreateIssueDependenciesNotFound) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/dependencies][%d] issueCreateIssueDependenciesNotFound", 404)
}

func (o *IssueCreateIssueDependenciesNotFound) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/dependencies][%d] issueCreateIssueDependenciesNotFound", 404)
}

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

	return nil
}

// NewIssueCreateIssueDependenciesLocked creates a IssueCreateIssueDependenciesLocked with default headers values
func NewIssueCreateIssueDependenciesLocked() *IssueCreateIssueDependenciesLocked {
	return &IssueCreateIssueDependenciesLocked{}
}

/*
IssueCreateIssueDependenciesLocked 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 IssueCreateIssueDependenciesLocked struct {
	Message string
	URL     string
}

// IsSuccess returns true when this issue create issue dependencies locked response has a 2xx status code
func (o *IssueCreateIssueDependenciesLocked) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this issue create issue dependencies locked response has a 3xx status code
func (o *IssueCreateIssueDependenciesLocked) IsRedirect() bool {
	return false
}

// IsClientError returns true when this issue create issue dependencies locked response has a 4xx status code
func (o *IssueCreateIssueDependenciesLocked) IsClientError() bool {
	return true
}

// IsServerError returns true when this issue create issue dependencies locked response has a 5xx status code
func (o *IssueCreateIssueDependenciesLocked) IsServerError() bool {
	return false
}

// IsCode returns true when this issue create issue dependencies locked response a status code equal to that given
func (o *IssueCreateIssueDependenciesLocked) IsCode(code int) bool {
	return code == 423
}

// Code gets the status code for the issue create issue dependencies locked response
func (o *IssueCreateIssueDependenciesLocked) Code() int {
	return 423
}

func (o *IssueCreateIssueDependenciesLocked) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/dependencies][%d] issueCreateIssueDependenciesLocked", 423)
}

func (o *IssueCreateIssueDependenciesLocked) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/{index}/dependencies][%d] issueCreateIssueDependenciesLocked", 423)
}

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