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

// GetSupportedArchitecturesReader is a Reader for the GetSupportedArchitectures structure.
type GetSupportedArchitecturesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetSupportedArchitecturesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetSupportedArchitecturesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetSupportedArchitecturesBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetSupportedArchitecturesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetSupportedArchitecturesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetSupportedArchitecturesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetSupportedArchitecturesServiceUnavailable()
		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())
	}
}

// NewGetSupportedArchitecturesOK creates a GetSupportedArchitecturesOK with default headers values
func NewGetSupportedArchitecturesOK() *GetSupportedArchitecturesOK {
	return &GetSupportedArchitecturesOK{}
}

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

Success.
*/
type GetSupportedArchitecturesOK struct {
	Payload *GetSupportedArchitecturesOKBody
}

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

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

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

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

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

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

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

func (o *GetSupportedArchitecturesOK) GetPayload() *GetSupportedArchitecturesOKBody {
	return o.Payload
}

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

	o.Payload = new(GetSupportedArchitecturesOKBody)

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

	return nil
}

// NewGetSupportedArchitecturesBadRequest creates a GetSupportedArchitecturesBadRequest with default headers values
func NewGetSupportedArchitecturesBadRequest() *GetSupportedArchitecturesBadRequest {
	return &GetSupportedArchitecturesBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetSupportedArchitecturesUnauthorized creates a GetSupportedArchitecturesUnauthorized with default headers values
func NewGetSupportedArchitecturesUnauthorized() *GetSupportedArchitecturesUnauthorized {
	return &GetSupportedArchitecturesUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetSupportedArchitecturesForbidden creates a GetSupportedArchitecturesForbidden with default headers values
func NewGetSupportedArchitecturesForbidden() *GetSupportedArchitecturesForbidden {
	return &GetSupportedArchitecturesForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetSupportedArchitecturesNotFound creates a GetSupportedArchitecturesNotFound with default headers values
func NewGetSupportedArchitecturesNotFound() *GetSupportedArchitecturesNotFound {
	return &GetSupportedArchitecturesNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetSupportedArchitecturesServiceUnavailable creates a GetSupportedArchitecturesServiceUnavailable with default headers values
func NewGetSupportedArchitecturesServiceUnavailable() *GetSupportedArchitecturesServiceUnavailable {
	return &GetSupportedArchitecturesServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

/*
GetSupportedArchitecturesOKBody get supported architectures o k body
swagger:model GetSupportedArchitecturesOKBody
*/
type GetSupportedArchitecturesOKBody struct {

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

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

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

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

func (o *GetSupportedArchitecturesOKBody) validateArchitectures(formats strfmt.Registry) error {
	if swag.IsZero(o.Architectures) { // not required
		return nil
	}

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

	return nil
}

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

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

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

func (o *GetSupportedArchitecturesOKBody) contextValidateArchitectures(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

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

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