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

package account

// 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/runtime"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"

	"github.com/openziti/zrok/rest_model_zrok"
)

// RegisterReader is a Reader for the Register structure.
type RegisterReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RegisterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewRegisterOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 404:
		result := NewRegisterNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewRegisterUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewRegisterInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /register] register", response, response.Code())
	}
}

// NewRegisterOK creates a RegisterOK with default headers values
func NewRegisterOK() *RegisterOK {
	return &RegisterOK{}
}

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

account created
*/
type RegisterOK struct {
	Payload *RegisterOKBody
}

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

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

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

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

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

// Code gets the status code for the register o k response
func (o *RegisterOK) Code() int {
	return 200
}

func (o *RegisterOK) Error() string {
	return fmt.Sprintf("[POST /register][%d] registerOK  %+v", 200, o.Payload)
}

func (o *RegisterOK) String() string {
	return fmt.Sprintf("[POST /register][%d] registerOK  %+v", 200, o.Payload)
}

func (o *RegisterOK) GetPayload() *RegisterOKBody {
	return o.Payload
}

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

	o.Payload = new(RegisterOKBody)

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

	return nil
}

// NewRegisterNotFound creates a RegisterNotFound with default headers values
func NewRegisterNotFound() *RegisterNotFound {
	return &RegisterNotFound{}
}

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

request not found
*/
type RegisterNotFound struct {
}

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

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

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

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

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

// Code gets the status code for the register not found response
func (o *RegisterNotFound) Code() int {
	return 404
}

func (o *RegisterNotFound) Error() string {
	return fmt.Sprintf("[POST /register][%d] registerNotFound ", 404)
}

func (o *RegisterNotFound) String() string {
	return fmt.Sprintf("[POST /register][%d] registerNotFound ", 404)
}

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

	return nil
}

// NewRegisterUnprocessableEntity creates a RegisterUnprocessableEntity with default headers values
func NewRegisterUnprocessableEntity() *RegisterUnprocessableEntity {
	return &RegisterUnprocessableEntity{}
}

/*
RegisterUnprocessableEntity describes a response with status code 422, with default header values.

password validation failure
*/
type RegisterUnprocessableEntity struct {
	Payload rest_model_zrok.ErrorMessage
}

// IsSuccess returns true when this register unprocessable entity response has a 2xx status code
func (o *RegisterUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this register unprocessable entity response has a 3xx status code
func (o *RegisterUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this register unprocessable entity response has a 4xx status code
func (o *RegisterUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this register unprocessable entity response has a 5xx status code
func (o *RegisterUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this register unprocessable entity response a status code equal to that given
func (o *RegisterUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the register unprocessable entity response
func (o *RegisterUnprocessableEntity) Code() int {
	return 422
}

func (o *RegisterUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /register][%d] registerUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *RegisterUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /register][%d] registerUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *RegisterUnprocessableEntity) GetPayload() rest_model_zrok.ErrorMessage {
	return o.Payload
}

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

// NewRegisterInternalServerError creates a RegisterInternalServerError with default headers values
func NewRegisterInternalServerError() *RegisterInternalServerError {
	return &RegisterInternalServerError{}
}

/*
RegisterInternalServerError describes a response with status code 500, with default header values.

internal server error
*/
type RegisterInternalServerError struct {
}

// IsSuccess returns true when this register internal server error response has a 2xx status code
func (o *RegisterInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this register internal server error response has a 3xx status code
func (o *RegisterInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this register internal server error response has a 4xx status code
func (o *RegisterInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this register internal server error response has a 5xx status code
func (o *RegisterInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this register internal server error response a status code equal to that given
func (o *RegisterInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the register internal server error response
func (o *RegisterInternalServerError) Code() int {
	return 500
}

func (o *RegisterInternalServerError) Error() string {
	return fmt.Sprintf("[POST /register][%d] registerInternalServerError ", 500)
}

func (o *RegisterInternalServerError) String() string {
	return fmt.Sprintf("[POST /register][%d] registerInternalServerError ", 500)
}

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

	return nil
}

/*
RegisterBody register body
swagger:model RegisterBody
*/
type RegisterBody struct {

	// password
	Password string `json:"password,omitempty"`

	// token
	Token string `json:"token,omitempty"`
}

// Validate validates this register body
func (o *RegisterBody) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this register body based on context it is used
func (o *RegisterBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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

/*
RegisterOKBody register o k body
swagger:model RegisterOKBody
*/
type RegisterOKBody struct {

	// token
	Token string `json:"token,omitempty"`
}

// Validate validates this register o k body
func (o *RegisterOKBody) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this register o k body based on context it is used
func (o *RegisterOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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