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

	"github.com/grafana/grafana-openapi-client-go/models"
)

// PutMuteTimingReader is a Reader for the PutMuteTiming structure.
type PutMuteTimingReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutMuteTimingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 202:
		result := NewPutMuteTimingAccepted()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutMuteTimingBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPutMuteTimingConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /v1/provisioning/mute-timings/{name}] PutMuteTiming", response, response.Code())
	}
}

// NewPutMuteTimingAccepted creates a PutMuteTimingAccepted with default headers values
func NewPutMuteTimingAccepted() *PutMuteTimingAccepted {
	return &PutMuteTimingAccepted{}
}

/*
PutMuteTimingAccepted describes a response with status code 202, with default header values.

MuteTimeInterval
*/
type PutMuteTimingAccepted struct {
	Payload *models.MuteTimeInterval
}

// IsSuccess returns true when this put mute timing accepted response has a 2xx status code
func (o *PutMuteTimingAccepted) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this put mute timing accepted response has a 3xx status code
func (o *PutMuteTimingAccepted) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put mute timing accepted response has a 4xx status code
func (o *PutMuteTimingAccepted) IsClientError() bool {
	return false
}

// IsServerError returns true when this put mute timing accepted response has a 5xx status code
func (o *PutMuteTimingAccepted) IsServerError() bool {
	return false
}

// IsCode returns true when this put mute timing accepted response a status code equal to that given
func (o *PutMuteTimingAccepted) IsCode(code int) bool {
	return code == 202
}

// Code gets the status code for the put mute timing accepted response
func (o *PutMuteTimingAccepted) Code() int {
	return 202
}

func (o *PutMuteTimingAccepted) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /v1/provisioning/mute-timings/{name}][%d] putMuteTimingAccepted %s", 202, payload)
}

func (o *PutMuteTimingAccepted) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /v1/provisioning/mute-timings/{name}][%d] putMuteTimingAccepted %s", 202, payload)
}

func (o *PutMuteTimingAccepted) GetPayload() *models.MuteTimeInterval {
	return o.Payload
}

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

	o.Payload = new(models.MuteTimeInterval)

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

	return nil
}

// NewPutMuteTimingBadRequest creates a PutMuteTimingBadRequest with default headers values
func NewPutMuteTimingBadRequest() *PutMuteTimingBadRequest {
	return &PutMuteTimingBadRequest{}
}

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

ValidationError
*/
type PutMuteTimingBadRequest struct {
	Payload *models.ValidationError
}

// IsSuccess returns true when this put mute timing bad request response has a 2xx status code
func (o *PutMuteTimingBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put mute timing bad request response has a 3xx status code
func (o *PutMuteTimingBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put mute timing bad request response has a 4xx status code
func (o *PutMuteTimingBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this put mute timing bad request response has a 5xx status code
func (o *PutMuteTimingBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this put mute timing bad request response a status code equal to that given
func (o *PutMuteTimingBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the put mute timing bad request response
func (o *PutMuteTimingBadRequest) Code() int {
	return 400
}

func (o *PutMuteTimingBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /v1/provisioning/mute-timings/{name}][%d] putMuteTimingBadRequest %s", 400, payload)
}

func (o *PutMuteTimingBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /v1/provisioning/mute-timings/{name}][%d] putMuteTimingBadRequest %s", 400, payload)
}

func (o *PutMuteTimingBadRequest) GetPayload() *models.ValidationError {
	return o.Payload
}

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

	o.Payload = new(models.ValidationError)

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

	return nil
}

// NewPutMuteTimingConflict creates a PutMuteTimingConflict with default headers values
func NewPutMuteTimingConflict() *PutMuteTimingConflict {
	return &PutMuteTimingConflict{}
}

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

PublicError
*/
type PutMuteTimingConflict struct {
	Payload *models.PublicError
}

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

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

// IsClientError returns true when this put mute timing conflict response has a 4xx status code
func (o *PutMuteTimingConflict) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the put mute timing conflict response
func (o *PutMuteTimingConflict) Code() int {
	return 409
}

func (o *PutMuteTimingConflict) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /v1/provisioning/mute-timings/{name}][%d] putMuteTimingConflict %s", 409, payload)
}

func (o *PutMuteTimingConflict) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /v1/provisioning/mute-timings/{name}][%d] putMuteTimingConflict %s", 409, payload)
}

func (o *PutMuteTimingConflict) GetPayload() *models.PublicError {
	return o.Payload
}

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

	o.Payload = new(models.PublicError)

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

	return nil
}
