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

// IssueAddLabelReader is a Reader for the IssueAddLabel structure.
type IssueAddLabelReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *IssueAddLabelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewIssueAddLabelOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewIssueAddLabelForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewIssueAddLabelNotFound()
		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}/labels] issueAddLabel", response, response.Code())
	}
}

// NewIssueAddLabelOK creates a IssueAddLabelOK with default headers values
func NewIssueAddLabelOK() *IssueAddLabelOK {
	return &IssueAddLabelOK{}
}

/*
IssueAddLabelOK describes a response with status code 200, with default header values.

LabelList
*/
type IssueAddLabelOK struct {
	Payload []*models.Label
}

// IsSuccess returns true when this issue add label o k response has a 2xx status code
func (o *IssueAddLabelOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this issue add label o k response has a 3xx status code
func (o *IssueAddLabelOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this issue add label o k response has a 4xx status code
func (o *IssueAddLabelOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this issue add label o k response has a 5xx status code
func (o *IssueAddLabelOK) IsServerError() bool {
	return false
}

// IsCode returns true when this issue add label o k response a status code equal to that given
func (o *IssueAddLabelOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the issue add label o k response
func (o *IssueAddLabelOK) Code() int {
	return 200
}

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

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

func (o *IssueAddLabelOK) GetPayload() []*models.Label {
	return o.Payload
}

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

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

	return nil
}

// NewIssueAddLabelForbidden creates a IssueAddLabelForbidden with default headers values
func NewIssueAddLabelForbidden() *IssueAddLabelForbidden {
	return &IssueAddLabelForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewIssueAddLabelNotFound creates a IssueAddLabelNotFound with default headers values
func NewIssueAddLabelNotFound() *IssueAddLabelNotFound {
	return &IssueAddLabelNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

	return nil
}