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

package share

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/openziti/zrok/rest_model_zrok"
)

// ShareReader is a Reader for the Share structure.
type ShareReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ShareReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewShareCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewShareUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewShareNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewShareConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewShareUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewShareInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /share] share", response, response.Code())
	}
}

// NewShareCreated creates a ShareCreated with default headers values
func NewShareCreated() *ShareCreated {
	return &ShareCreated{}
}

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

share created
*/
type ShareCreated struct {
	Payload *rest_model_zrok.ShareResponse
}

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

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

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

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

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

// Code gets the status code for the share created response
func (o *ShareCreated) Code() int {
	return 201
}

func (o *ShareCreated) Error() string {
	return fmt.Sprintf("[POST /share][%d] shareCreated  %+v", 201, o.Payload)
}

func (o *ShareCreated) String() string {
	return fmt.Sprintf("[POST /share][%d] shareCreated  %+v", 201, o.Payload)
}

func (o *ShareCreated) GetPayload() *rest_model_zrok.ShareResponse {
	return o.Payload
}

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

	o.Payload = new(rest_model_zrok.ShareResponse)

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

	return nil
}

// NewShareUnauthorized creates a ShareUnauthorized with default headers values
func NewShareUnauthorized() *ShareUnauthorized {
	return &ShareUnauthorized{}
}

/*
ShareUnauthorized describes a response with status code 401, with default header values.

unauthorized
*/
type ShareUnauthorized struct {
}

// IsSuccess returns true when this share unauthorized response has a 2xx status code
func (o *ShareUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this share unauthorized response has a 3xx status code
func (o *ShareUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this share unauthorized response has a 4xx status code
func (o *ShareUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this share unauthorized response has a 5xx status code
func (o *ShareUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this share unauthorized response a status code equal to that given
func (o *ShareUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the share unauthorized response
func (o *ShareUnauthorized) Code() int {
	return 401
}

func (o *ShareUnauthorized) Error() string {
	return fmt.Sprintf("[POST /share][%d] shareUnauthorized ", 401)
}

func (o *ShareUnauthorized) String() string {
	return fmt.Sprintf("[POST /share][%d] shareUnauthorized ", 401)
}

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

	return nil
}

// NewShareNotFound creates a ShareNotFound with default headers values
func NewShareNotFound() *ShareNotFound {
	return &ShareNotFound{}
}

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

not found
*/
type ShareNotFound struct {
}

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

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

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

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

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

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

func (o *ShareNotFound) Error() string {
	return fmt.Sprintf("[POST /share][%d] shareNotFound ", 404)
}

func (o *ShareNotFound) String() string {
	return fmt.Sprintf("[POST /share][%d] shareNotFound ", 404)
}

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

	return nil
}

// NewShareConflict creates a ShareConflict with default headers values
func NewShareConflict() *ShareConflict {
	return &ShareConflict{}
}

/*
ShareConflict describes a response with status code 409, with default header values.

conflict
*/
type ShareConflict struct {
}

// IsSuccess returns true when this share conflict response has a 2xx status code
func (o *ShareConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this share conflict response has a 3xx status code
func (o *ShareConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this share conflict response has a 4xx status code
func (o *ShareConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this share conflict response has a 5xx status code
func (o *ShareConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this share conflict response a status code equal to that given
func (o *ShareConflict) IsCode(code int) bool {
	return code == 409
}

// Code gets the status code for the share conflict response
func (o *ShareConflict) Code() int {
	return 409
}

func (o *ShareConflict) Error() string {
	return fmt.Sprintf("[POST /share][%d] shareConflict ", 409)
}

func (o *ShareConflict) String() string {
	return fmt.Sprintf("[POST /share][%d] shareConflict ", 409)
}

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

	return nil
}

// NewShareUnprocessableEntity creates a ShareUnprocessableEntity with default headers values
func NewShareUnprocessableEntity() *ShareUnprocessableEntity {
	return &ShareUnprocessableEntity{}
}

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

unprocessable
*/
type ShareUnprocessableEntity struct {
}

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

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

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

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

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

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

func (o *ShareUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /share][%d] shareUnprocessableEntity ", 422)
}

func (o *ShareUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /share][%d] shareUnprocessableEntity ", 422)
}

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

	return nil
}

// NewShareInternalServerError creates a ShareInternalServerError with default headers values
func NewShareInternalServerError() *ShareInternalServerError {
	return &ShareInternalServerError{}
}

/*
ShareInternalServerError describes a response with status code 500, with default header values.

internal server error
*/
type ShareInternalServerError struct {
	Payload rest_model_zrok.ErrorMessage
}

// IsSuccess returns true when this share internal server error response has a 2xx status code
func (o *ShareInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this share internal server error response has a 3xx status code
func (o *ShareInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this share internal server error response has a 4xx status code
func (o *ShareInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this share internal server error response has a 5xx status code
func (o *ShareInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this share internal server error response a status code equal to that given
func (o *ShareInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the share internal server error response
func (o *ShareInternalServerError) Code() int {
	return 500
}

func (o *ShareInternalServerError) Error() string {
	return fmt.Sprintf("[POST /share][%d] shareInternalServerError  %+v", 500, o.Payload)
}

func (o *ShareInternalServerError) String() string {
	return fmt.Sprintf("[POST /share][%d] shareInternalServerError  %+v", 500, o.Payload)
}

func (o *ShareInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
	return o.Payload
}

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