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

package security_management_roles

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

	"github.com/030/n3dr/internal/app/n3dr/goswagger/models"
)

// CreateReader is a Reader for the Create structure.
type CreateReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *CreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewCreateOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewCreateForbidden()
		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())
	}
}

// NewCreateOK creates a CreateOK with default headers values
func NewCreateOK() *CreateOK {
	return &CreateOK{}
}

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

successful operation
*/
type CreateOK struct {
	Payload *models.RoleXOResponse
}

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

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

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

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

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

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

func (o *CreateOK) Error() string {
	return fmt.Sprintf("[POST /v1/security/roles][%d] createOK  %+v", 200, o.Payload)
}

func (o *CreateOK) String() string {
	return fmt.Sprintf("[POST /v1/security/roles][%d] createOK  %+v", 200, o.Payload)
}

func (o *CreateOK) GetPayload() *models.RoleXOResponse {
	return o.Payload
}

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

	o.Payload = new(models.RoleXOResponse)

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

	return nil
}

// NewCreateForbidden creates a CreateForbidden with default headers values
func NewCreateForbidden() *CreateForbidden {
	return &CreateForbidden{}
}

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

Insufficient permissions to create role
*/
type CreateForbidden struct {
}

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

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

// IsClientError returns true when this create forbidden response has a 4xx status code
func (o *CreateForbidden) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the create forbidden response
func (o *CreateForbidden) Code() int {
	return 403
}

func (o *CreateForbidden) Error() string {
	return fmt.Sprintf("[POST /v1/security/roles][%d] createForbidden ", 403)
}

func (o *CreateForbidden) String() string {
	return fmt.Sprintf("[POST /v1/security/roles][%d] createForbidden ", 403)
}

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

	return nil
}
