// 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 (
	"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 200:
		result := NewPutMuteTimingOK()
		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
	default:
		return nil, runtime.NewAPIError("[PUT /v1/provisioning/mute-timings/{name}] PutMuteTiming", response, response.Code())
	}
}

// NewPutMuteTimingOK creates a PutMuteTimingOK with default headers values
func NewPutMuteTimingOK() *PutMuteTimingOK {
	return &PutMuteTimingOK{}
}

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

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

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

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

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

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

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

// Code gets the status code for the put mute timing Ok response
func (o *PutMuteTimingOK) Code() int {
	return 200
}

func (o *PutMuteTimingOK) Error() string {
	return fmt.Sprintf("[PUT /v1/provisioning/mute-timings/{name}][%d] putMuteTimingOk  %+v", 200, o.Payload)
}

func (o *PutMuteTimingOK) String() string {
	return fmt.Sprintf("[PUT /v1/provisioning/mute-timings/{name}][%d] putMuteTimingOk  %+v", 200, o.Payload)
}

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

func (o *PutMuteTimingOK) 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 {
	return fmt.Sprintf("[PUT /v1/provisioning/mute-timings/{name}][%d] putMuteTimingBadRequest  %+v", 400, o.Payload)
}

func (o *PutMuteTimingBadRequest) String() string {
	return fmt.Sprintf("[PUT /v1/provisioning/mute-timings/{name}][%d] putMuteTimingBadRequest  %+v", 400, o.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
}
