// Code generated by go-swagger; DO NOT EDIT.

package organization

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

// OrgCreateHookReader is a Reader for the OrgCreateHook structure.
type OrgCreateHookReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *OrgCreateHookReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewOrgCreateHookCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 404:
		result := NewOrgCreateHookNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /orgs/{org}/hooks] orgCreateHook", response, response.Code())
	}
}

// NewOrgCreateHookCreated creates a OrgCreateHookCreated with default headers values
func NewOrgCreateHookCreated() *OrgCreateHookCreated {
	return &OrgCreateHookCreated{}
}

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

Hook
*/
type OrgCreateHookCreated struct {
	Payload *models.Hook
}

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

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

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

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

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

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

func (o *OrgCreateHookCreated) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /orgs/{org}/hooks][%d] orgCreateHookCreated %s", 201, payload)
}

func (o *OrgCreateHookCreated) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /orgs/{org}/hooks][%d] orgCreateHookCreated %s", 201, payload)
}

func (o *OrgCreateHookCreated) GetPayload() *models.Hook {
	return o.Payload
}

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

	o.Payload = new(models.Hook)

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

	return nil
}

// NewOrgCreateHookNotFound creates a OrgCreateHookNotFound with default headers values
func NewOrgCreateHookNotFound() *OrgCreateHookNotFound {
	return &OrgCreateHookNotFound{}
}

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

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

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

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

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

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

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

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

func (o *OrgCreateHookNotFound) Error() string {
	return fmt.Sprintf("[POST /orgs/{org}/hooks][%d] orgCreateHookNotFound", 404)
}

func (o *OrgCreateHookNotFound) String() string {
	return fmt.Sprintf("[POST /orgs/{org}/hooks][%d] orgCreateHookNotFound", 404)
}

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

	return nil
}
