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

package operations

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

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

	models "github.com/bloomberg/goldpinger/pkg/models"
)

// HealthzReader is a Reader for the Healthz structure.
type HealthzReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *HealthzReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {

	case 200:
		result := NewHealthzOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil

	case 503:
		result := NewHealthzServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}

// NewHealthzOK creates a HealthzOK with default headers values
func NewHealthzOK() *HealthzOK {
	return &HealthzOK{}
}

/*HealthzOK handles this case with default header values.

Health check report
*/
type HealthzOK struct {
	Payload *models.HealthCheckResults
}

func (o *HealthzOK) Error() string {
	return fmt.Sprintf("[GET /healthz][%d] healthzOK  %+v", 200, o.Payload)
}

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

	o.Payload = new(models.HealthCheckResults)

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

	return nil
}

// NewHealthzServiceUnavailable creates a HealthzServiceUnavailable with default headers values
func NewHealthzServiceUnavailable() *HealthzServiceUnavailable {
	return &HealthzServiceUnavailable{}
}

/*HealthzServiceUnavailable handles this case with default header values.

Unhealthy service
*/
type HealthzServiceUnavailable struct {
	Payload *models.HealthCheckResults
}

func (o *HealthzServiceUnavailable) Error() string {
	return fmt.Sprintf("[GET /healthz][%d] healthzServiceUnavailable  %+v", 503, o.Payload)
}

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

	o.Payload = new(models.HealthCheckResults)

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

	return nil
}
