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

// IssuePostIssueReactionReader is a Reader for the IssuePostIssueReaction structure.
type IssuePostIssueReactionReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *IssuePostIssueReactionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewIssuePostIssueReactionOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 201:
		result := NewIssuePostIssueReactionCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewIssuePostIssueReactionForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewIssuePostIssueReactionNotFound()
		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}/reactions] issuePostIssueReaction", response, response.Code())
	}
}

// NewIssuePostIssueReactionOK creates a IssuePostIssueReactionOK with default headers values
func NewIssuePostIssueReactionOK() *IssuePostIssueReactionOK {
	return &IssuePostIssueReactionOK{}
}

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

Reaction
*/
type IssuePostIssueReactionOK struct {
	Payload *models.Reaction
}

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

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

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

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

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

// Code gets the status code for the issue post issue reaction o k response
func (o *IssuePostIssueReactionOK) Code() int {
	return 200
}

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

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

func (o *IssuePostIssueReactionOK) GetPayload() *models.Reaction {
	return o.Payload
}

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

	o.Payload = new(models.Reaction)

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

	return nil
}

// NewIssuePostIssueReactionCreated creates a IssuePostIssueReactionCreated with default headers values
func NewIssuePostIssueReactionCreated() *IssuePostIssueReactionCreated {
	return &IssuePostIssueReactionCreated{}
}

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

Reaction
*/
type IssuePostIssueReactionCreated struct {
	Payload *models.Reaction
}

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

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

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

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

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

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

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

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

func (o *IssuePostIssueReactionCreated) GetPayload() *models.Reaction {
	return o.Payload
}

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

	o.Payload = new(models.Reaction)

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

	return nil
}

// NewIssuePostIssueReactionForbidden creates a IssuePostIssueReactionForbidden with default headers values
func NewIssuePostIssueReactionForbidden() *IssuePostIssueReactionForbidden {
	return &IssuePostIssueReactionForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewIssuePostIssueReactionNotFound creates a IssuePostIssueReactionNotFound with default headers values
func NewIssuePostIssueReactionNotFound() *IssuePostIssueReactionNotFound {
	return &IssuePostIssueReactionNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

	return nil
}
