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

// IssueCreateIssueReader is a Reader for the IssueCreateIssue structure.
type IssueCreateIssueReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *IssueCreateIssueReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewIssueCreateIssueCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewIssueCreateIssueForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewIssueCreateIssueNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 412:
		result := NewIssueCreateIssuePreconditionFailed()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewIssueCreateIssueUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 423:
		result := NewIssueCreateIssueLocked()
		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] issueCreateIssue", response, response.Code())
	}
}

// NewIssueCreateIssueCreated creates a IssueCreateIssueCreated with default headers values
func NewIssueCreateIssueCreated() *IssueCreateIssueCreated {
	return &IssueCreateIssueCreated{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewIssueCreateIssueForbidden creates a IssueCreateIssueForbidden with default headers values
func NewIssueCreateIssueForbidden() *IssueCreateIssueForbidden {
	return &IssueCreateIssueForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewIssueCreateIssueNotFound creates a IssueCreateIssueNotFound with default headers values
func NewIssueCreateIssueNotFound() *IssueCreateIssueNotFound {
	return &IssueCreateIssueNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

	return nil
}

// NewIssueCreateIssuePreconditionFailed creates a IssueCreateIssuePreconditionFailed with default headers values
func NewIssueCreateIssuePreconditionFailed() *IssueCreateIssuePreconditionFailed {
	return &IssueCreateIssuePreconditionFailed{}
}

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

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

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

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

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

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

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

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

func (o *IssueCreateIssuePreconditionFailed) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssuePreconditionFailed", 412)
}

func (o *IssueCreateIssuePreconditionFailed) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues][%d] issueCreateIssuePreconditionFailed", 412)
}

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

// NewIssueCreateIssueUnprocessableEntity creates a IssueCreateIssueUnprocessableEntity with default headers values
func NewIssueCreateIssueUnprocessableEntity() *IssueCreateIssueUnprocessableEntity {
	return &IssueCreateIssueUnprocessableEntity{}
}

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

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

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

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

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

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

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

// Code gets the status code for the issue create issue unprocessable entity response
func (o *IssueCreateIssueUnprocessableEntity) Code() int {
	return 422
}

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

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

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

// NewIssueCreateIssueLocked creates a IssueCreateIssueLocked with default headers values
func NewIssueCreateIssueLocked() *IssueCreateIssueLocked {
	return &IssueCreateIssueLocked{}
}

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

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

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

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

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

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

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

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

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

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