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

package provisioning

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

	"0xacab.org/leap/menshen/models"
)

// GetProviderJSONReader is a Reader for the GetProviderJSON structure.
type GetProviderJSONReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetProviderJSONReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetProviderJSONOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetProviderJSONBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetProviderJSONNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetProviderJSONInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /provider.json] GetProviderJSON", response, response.Code())
	}
}

// NewGetProviderJSONOK creates a GetProviderJSONOK with default headers values
func NewGetProviderJSONOK() *GetProviderJSONOK {
	return &GetProviderJSONOK{}
}

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

OK
*/
type GetProviderJSONOK struct {
	Payload *models.ModelsProvider
}

// IsSuccess returns true when this get provider Json o k response has a 2xx status code
func (o *GetProviderJSONOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get provider Json o k response has a 3xx status code
func (o *GetProviderJSONOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get provider Json o k response has a 4xx status code
func (o *GetProviderJSONOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get provider Json o k response has a 5xx status code
func (o *GetProviderJSONOK) IsServerError() bool {
	return false
}

// IsCode returns true when this get provider Json o k response a status code equal to that given
func (o *GetProviderJSONOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the get provider Json o k response
func (o *GetProviderJSONOK) Code() int {
	return 200
}

func (o *GetProviderJSONOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /provider.json][%d] getProviderJsonOK %s", 200, payload)
}

func (o *GetProviderJSONOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /provider.json][%d] getProviderJsonOK %s", 200, payload)
}

func (o *GetProviderJSONOK) GetPayload() *models.ModelsProvider {
	return o.Payload
}

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

	o.Payload = new(models.ModelsProvider)

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

	return nil
}

// NewGetProviderJSONBadRequest creates a GetProviderJSONBadRequest with default headers values
func NewGetProviderJSONBadRequest() *GetProviderJSONBadRequest {
	return &GetProviderJSONBadRequest{}
}

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

Bad Request
*/
type GetProviderJSONBadRequest struct {
	Payload interface{}
}

// IsSuccess returns true when this get provider Json bad request response has a 2xx status code
func (o *GetProviderJSONBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get provider Json bad request response has a 3xx status code
func (o *GetProviderJSONBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get provider Json bad request response has a 4xx status code
func (o *GetProviderJSONBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this get provider Json bad request response has a 5xx status code
func (o *GetProviderJSONBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this get provider Json bad request response a status code equal to that given
func (o *GetProviderJSONBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the get provider Json bad request response
func (o *GetProviderJSONBadRequest) Code() int {
	return 400
}

func (o *GetProviderJSONBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /provider.json][%d] getProviderJsonBadRequest %s", 400, payload)
}

func (o *GetProviderJSONBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /provider.json][%d] getProviderJsonBadRequest %s", 400, payload)
}

func (o *GetProviderJSONBadRequest) GetPayload() interface{} {
	return o.Payload
}

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

// NewGetProviderJSONNotFound creates a GetProviderJSONNotFound with default headers values
func NewGetProviderJSONNotFound() *GetProviderJSONNotFound {
	return &GetProviderJSONNotFound{}
}

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

Not Found
*/
type GetProviderJSONNotFound struct {
	Payload interface{}
}

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

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

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

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

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

// Code gets the status code for the get provider Json not found response
func (o *GetProviderJSONNotFound) Code() int {
	return 404
}

func (o *GetProviderJSONNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /provider.json][%d] getProviderJsonNotFound %s", 404, payload)
}

func (o *GetProviderJSONNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /provider.json][%d] getProviderJsonNotFound %s", 404, payload)
}

func (o *GetProviderJSONNotFound) GetPayload() interface{} {
	return o.Payload
}

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

// NewGetProviderJSONInternalServerError creates a GetProviderJSONInternalServerError with default headers values
func NewGetProviderJSONInternalServerError() *GetProviderJSONInternalServerError {
	return &GetProviderJSONInternalServerError{}
}

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

Internal Server Error
*/
type GetProviderJSONInternalServerError struct {
	Payload interface{}
}

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

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

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

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

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

// Code gets the status code for the get provider Json internal server error response
func (o *GetProviderJSONInternalServerError) Code() int {
	return 500
}

func (o *GetProviderJSONInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /provider.json][%d] getProviderJsonInternalServerError %s", 500, payload)
}

func (o *GetProviderJSONInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /provider.json][%d] getProviderJsonInternalServerError %s", 500, payload)
}

func (o *GetProviderJSONInternalServerError) GetPayload() interface{} {
	return o.Payload
}

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