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

package first_run

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

	apiserver_params "github.com/cloudbase/garm/apiserver/params"
	garm_params "github.com/cloudbase/garm/params"
)

// FirstRunReader is a Reader for the FirstRun structure.
type FirstRunReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *FirstRunReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewFirstRunOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewFirstRunBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /first-run] FirstRun", response, response.Code())
	}
}

// NewFirstRunOK creates a FirstRunOK with default headers values
func NewFirstRunOK() *FirstRunOK {
	return &FirstRunOK{}
}

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

User
*/
type FirstRunOK struct {
	Payload garm_params.User
}

// IsSuccess returns true when this first run o k response has a 2xx status code
func (o *FirstRunOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this first run o k response has a 3xx status code
func (o *FirstRunOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this first run o k response has a 4xx status code
func (o *FirstRunOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this first run o k response has a 5xx status code
func (o *FirstRunOK) IsServerError() bool {
	return false
}

// IsCode returns true when this first run o k response a status code equal to that given
func (o *FirstRunOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the first run o k response
func (o *FirstRunOK) Code() int {
	return 200
}

func (o *FirstRunOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /first-run][%d] firstRunOK %s", 200, payload)
}

func (o *FirstRunOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /first-run][%d] firstRunOK %s", 200, payload)
}

func (o *FirstRunOK) GetPayload() garm_params.User {
	return o.Payload
}

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

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

	return nil
}

// NewFirstRunBadRequest creates a FirstRunBadRequest with default headers values
func NewFirstRunBadRequest() *FirstRunBadRequest {
	return &FirstRunBadRequest{}
}

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

APIErrorResponse
*/
type FirstRunBadRequest struct {
	Payload apiserver_params.APIErrorResponse
}

// IsSuccess returns true when this first run bad request response has a 2xx status code
func (o *FirstRunBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this first run bad request response has a 3xx status code
func (o *FirstRunBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this first run bad request response has a 4xx status code
func (o *FirstRunBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this first run bad request response has a 5xx status code
func (o *FirstRunBadRequest) IsServerError() bool {
	return false
}

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

// Code gets the status code for the first run bad request response
func (o *FirstRunBadRequest) Code() int {
	return 400
}

func (o *FirstRunBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /first-run][%d] firstRunBadRequest %s", 400, payload)
}

func (o *FirstRunBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /first-run][%d] firstRunBadRequest %s", 400, payload)
}

func (o *FirstRunBadRequest) GetPayload() apiserver_params.APIErrorResponse {
	return o.Payload
}

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

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

	return nil
}
