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

package installer

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

import (
	"context"
	"fmt"
	"io"

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

	"github.com/openshift/assisted-service/models"
)

// GetSupportedFeaturesReader is a Reader for the GetSupportedFeatures structure.
type GetSupportedFeaturesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetSupportedFeaturesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetSupportedFeaturesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetSupportedFeaturesBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetSupportedFeaturesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetSupportedFeaturesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetSupportedFeaturesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetSupportedFeaturesServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
	}
}

// NewGetSupportedFeaturesOK creates a GetSupportedFeaturesOK with default headers values
func NewGetSupportedFeaturesOK() *GetSupportedFeaturesOK {
	return &GetSupportedFeaturesOK{}
}

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

Success.
*/
type GetSupportedFeaturesOK struct {
	Payload *GetSupportedFeaturesOKBody
}

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

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

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

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

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

func (o *GetSupportedFeaturesOK) Error() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesOK  %+v", 200, o.Payload)
}

func (o *GetSupportedFeaturesOK) String() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesOK  %+v", 200, o.Payload)
}

func (o *GetSupportedFeaturesOK) GetPayload() *GetSupportedFeaturesOKBody {
	return o.Payload
}

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

	o.Payload = new(GetSupportedFeaturesOKBody)

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

	return nil
}

// NewGetSupportedFeaturesBadRequest creates a GetSupportedFeaturesBadRequest with default headers values
func NewGetSupportedFeaturesBadRequest() *GetSupportedFeaturesBadRequest {
	return &GetSupportedFeaturesBadRequest{}
}

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

Error.
*/
type GetSupportedFeaturesBadRequest struct {
	Payload *models.Error
}

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

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

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

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

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

func (o *GetSupportedFeaturesBadRequest) Error() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesBadRequest  %+v", 400, o.Payload)
}

func (o *GetSupportedFeaturesBadRequest) String() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesBadRequest  %+v", 400, o.Payload)
}

func (o *GetSupportedFeaturesBadRequest) GetPayload() *models.Error {
	return o.Payload
}

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

	o.Payload = new(models.Error)

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

	return nil
}

// NewGetSupportedFeaturesUnauthorized creates a GetSupportedFeaturesUnauthorized with default headers values
func NewGetSupportedFeaturesUnauthorized() *GetSupportedFeaturesUnauthorized {
	return &GetSupportedFeaturesUnauthorized{}
}

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

Unauthorized.
*/
type GetSupportedFeaturesUnauthorized struct {
	Payload *models.InfraError
}

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

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

// IsClientError returns true when this get supported features unauthorized response has a 4xx status code
func (o *GetSupportedFeaturesUnauthorized) IsClientError() bool {
	return true
}

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

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

func (o *GetSupportedFeaturesUnauthorized) Error() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesUnauthorized  %+v", 401, o.Payload)
}

func (o *GetSupportedFeaturesUnauthorized) String() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesUnauthorized  %+v", 401, o.Payload)
}

func (o *GetSupportedFeaturesUnauthorized) GetPayload() *models.InfraError {
	return o.Payload
}

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

	o.Payload = new(models.InfraError)

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

	return nil
}

// NewGetSupportedFeaturesForbidden creates a GetSupportedFeaturesForbidden with default headers values
func NewGetSupportedFeaturesForbidden() *GetSupportedFeaturesForbidden {
	return &GetSupportedFeaturesForbidden{}
}

/*
GetSupportedFeaturesForbidden describes a response with status code 403, with default header values.

Forbidden.
*/
type GetSupportedFeaturesForbidden struct {
	Payload *models.InfraError
}

// IsSuccess returns true when this get supported features forbidden response has a 2xx status code
func (o *GetSupportedFeaturesForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get supported features forbidden response has a 3xx status code
func (o *GetSupportedFeaturesForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get supported features forbidden response has a 4xx status code
func (o *GetSupportedFeaturesForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this get supported features forbidden response has a 5xx status code
func (o *GetSupportedFeaturesForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this get supported features forbidden response a status code equal to that given
func (o *GetSupportedFeaturesForbidden) IsCode(code int) bool {
	return code == 403
}

func (o *GetSupportedFeaturesForbidden) Error() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesForbidden  %+v", 403, o.Payload)
}

func (o *GetSupportedFeaturesForbidden) String() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesForbidden  %+v", 403, o.Payload)
}

func (o *GetSupportedFeaturesForbidden) GetPayload() *models.InfraError {
	return o.Payload
}

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

	o.Payload = new(models.InfraError)

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

	return nil
}

// NewGetSupportedFeaturesNotFound creates a GetSupportedFeaturesNotFound with default headers values
func NewGetSupportedFeaturesNotFound() *GetSupportedFeaturesNotFound {
	return &GetSupportedFeaturesNotFound{}
}

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

Error.
*/
type GetSupportedFeaturesNotFound struct {
	Payload *models.Error
}

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

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

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

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

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

func (o *GetSupportedFeaturesNotFound) Error() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesNotFound  %+v", 404, o.Payload)
}

func (o *GetSupportedFeaturesNotFound) String() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesNotFound  %+v", 404, o.Payload)
}

func (o *GetSupportedFeaturesNotFound) GetPayload() *models.Error {
	return o.Payload
}

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

	o.Payload = new(models.Error)

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

	return nil
}

// NewGetSupportedFeaturesServiceUnavailable creates a GetSupportedFeaturesServiceUnavailable with default headers values
func NewGetSupportedFeaturesServiceUnavailable() *GetSupportedFeaturesServiceUnavailable {
	return &GetSupportedFeaturesServiceUnavailable{}
}

/*
GetSupportedFeaturesServiceUnavailable describes a response with status code 503, with default header values.

Unavailable.
*/
type GetSupportedFeaturesServiceUnavailable struct {
	Payload *models.Error
}

// IsSuccess returns true when this get supported features service unavailable response has a 2xx status code
func (o *GetSupportedFeaturesServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get supported features service unavailable response has a 3xx status code
func (o *GetSupportedFeaturesServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get supported features service unavailable response has a 4xx status code
func (o *GetSupportedFeaturesServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this get supported features service unavailable response has a 5xx status code
func (o *GetSupportedFeaturesServiceUnavailable) IsServerError() bool {
	return true
}

// IsCode returns true when this get supported features service unavailable response a status code equal to that given
func (o *GetSupportedFeaturesServiceUnavailable) IsCode(code int) bool {
	return code == 503
}

func (o *GetSupportedFeaturesServiceUnavailable) Error() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesServiceUnavailable  %+v", 503, o.Payload)
}

func (o *GetSupportedFeaturesServiceUnavailable) String() string {
	return fmt.Sprintf("[GET /v2/support-levels/features][%d] getSupportedFeaturesServiceUnavailable  %+v", 503, o.Payload)
}

func (o *GetSupportedFeaturesServiceUnavailable) GetPayload() *models.Error {
	return o.Payload
}

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

	o.Payload = new(models.Error)

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

	return nil
}

/*
GetSupportedFeaturesOKBody get supported features o k body
swagger:model GetSupportedFeaturesOKBody
*/
type GetSupportedFeaturesOKBody struct {

	// Keys will be one of features-support-level-id enum.
	Features models.SupportLevels `json:"features,omitempty"`
}

// Validate validates this get supported features o k body
func (o *GetSupportedFeaturesOKBody) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateFeatures(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *GetSupportedFeaturesOKBody) validateFeatures(formats strfmt.Registry) error {
	if swag.IsZero(o.Features) { // not required
		return nil
	}

	if o.Features != nil {
		if err := o.Features.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("getSupportedFeaturesOK" + "." + "features")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("getSupportedFeaturesOK" + "." + "features")
			}
			return err
		}
	}

	return nil
}

// ContextValidate validate this get supported features o k body based on the context it is used
func (o *GetSupportedFeaturesOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	if err := o.contextValidateFeatures(ctx, formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *GetSupportedFeaturesOKBody) contextValidateFeatures(ctx context.Context, formats strfmt.Registry) error {

	if err := o.Features.ContextValidate(ctx, formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("getSupportedFeaturesOK" + "." + "features")
		} else if ce, ok := err.(*errors.CompositeError); ok {
			return ce.ValidateName("getSupportedFeaturesOK" + "." + "features")
		}
		return err
	}

	return nil
}

// MarshalBinary interface implementation
func (o *GetSupportedFeaturesOKBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *GetSupportedFeaturesOKBody) UnmarshalBinary(b []byte) error {
	var res GetSupportedFeaturesOKBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}
