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

// IssueCreateIssueCommentAttachmentReader is a Reader for the IssueCreateIssueCommentAttachment structure.
type IssueCreateIssueCommentAttachmentReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *IssueCreateIssueCommentAttachmentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewIssueCreateIssueCommentAttachmentCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewIssueCreateIssueCommentAttachmentBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewIssueCreateIssueCommentAttachmentForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewIssueCreateIssueCommentAttachmentNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewIssueCreateIssueCommentAttachmentUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 423:
		result := NewIssueCreateIssueCommentAttachmentLocked()
		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/comments/{id}/assets] issueCreateIssueCommentAttachment", response, response.Code())
	}
}

// NewIssueCreateIssueCommentAttachmentCreated creates a IssueCreateIssueCommentAttachmentCreated with default headers values
func NewIssueCreateIssueCommentAttachmentCreated() *IssueCreateIssueCommentAttachmentCreated {
	return &IssueCreateIssueCommentAttachmentCreated{}
}

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

Attachment
*/
type IssueCreateIssueCommentAttachmentCreated struct {
	Payload *models.Attachment
}

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

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

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

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

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

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

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

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

func (o *IssueCreateIssueCommentAttachmentCreated) GetPayload() *models.Attachment {
	return o.Payload
}

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

	o.Payload = new(models.Attachment)

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

	return nil
}

// NewIssueCreateIssueCommentAttachmentBadRequest creates a IssueCreateIssueCommentAttachmentBadRequest with default headers values
func NewIssueCreateIssueCommentAttachmentBadRequest() *IssueCreateIssueCommentAttachmentBadRequest {
	return &IssueCreateIssueCommentAttachmentBadRequest{}
}

/*
IssueCreateIssueCommentAttachmentBadRequest describes a response with status code 400, with default header values.

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

// IsSuccess returns true when this issue create issue comment attachment bad request response has a 2xx status code
func (o *IssueCreateIssueCommentAttachmentBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this issue create issue comment attachment bad request response has a 3xx status code
func (o *IssueCreateIssueCommentAttachmentBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this issue create issue comment attachment bad request response has a 4xx status code
func (o *IssueCreateIssueCommentAttachmentBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this issue create issue comment attachment bad request response has a 5xx status code
func (o *IssueCreateIssueCommentAttachmentBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this issue create issue comment attachment bad request response a status code equal to that given
func (o *IssueCreateIssueCommentAttachmentBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the issue create issue comment attachment bad request response
func (o *IssueCreateIssueCommentAttachmentBadRequest) Code() int {
	return 400
}

func (o *IssueCreateIssueCommentAttachmentBadRequest) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentBadRequest", 400)
}

func (o *IssueCreateIssueCommentAttachmentBadRequest) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentBadRequest", 400)
}

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

// NewIssueCreateIssueCommentAttachmentForbidden creates a IssueCreateIssueCommentAttachmentForbidden with default headers values
func NewIssueCreateIssueCommentAttachmentForbidden() *IssueCreateIssueCommentAttachmentForbidden {
	return &IssueCreateIssueCommentAttachmentForbidden{}
}

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

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

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

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

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

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

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

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

func (o *IssueCreateIssueCommentAttachmentForbidden) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentForbidden", 403)
}

func (o *IssueCreateIssueCommentAttachmentForbidden) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentForbidden", 403)
}

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

// NewIssueCreateIssueCommentAttachmentNotFound creates a IssueCreateIssueCommentAttachmentNotFound with default headers values
func NewIssueCreateIssueCommentAttachmentNotFound() *IssueCreateIssueCommentAttachmentNotFound {
	return &IssueCreateIssueCommentAttachmentNotFound{}
}

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

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

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

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

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

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

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

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

func (o *IssueCreateIssueCommentAttachmentNotFound) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentNotFound", 404)
}

func (o *IssueCreateIssueCommentAttachmentNotFound) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentNotFound", 404)
}

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

// NewIssueCreateIssueCommentAttachmentUnprocessableEntity creates a IssueCreateIssueCommentAttachmentUnprocessableEntity with default headers values
func NewIssueCreateIssueCommentAttachmentUnprocessableEntity() *IssueCreateIssueCommentAttachmentUnprocessableEntity {
	return &IssueCreateIssueCommentAttachmentUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

func (o *IssueCreateIssueCommentAttachmentUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentUnprocessableEntity", 422)
}

func (o *IssueCreateIssueCommentAttachmentUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentUnprocessableEntity", 422)
}

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

// NewIssueCreateIssueCommentAttachmentLocked creates a IssueCreateIssueCommentAttachmentLocked with default headers values
func NewIssueCreateIssueCommentAttachmentLocked() *IssueCreateIssueCommentAttachmentLocked {
	return &IssueCreateIssueCommentAttachmentLocked{}
}

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

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

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

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

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

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

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

func (o *IssueCreateIssueCommentAttachmentLocked) Error() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentLocked", 423)
}

func (o *IssueCreateIssueCommentAttachmentLocked) String() string {
	return fmt.Sprintf("[POST /repos/{owner}/{repo}/issues/comments/{id}/assets][%d] issueCreateIssueCommentAttachmentLocked", 423)
}

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