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

package security_certificates

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

// AddCertificateReader is a Reader for the AddCertificate structure.
type AddCertificateReader struct {
	formats strfmt.Registry
}

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

// NewAddCertificateCreated creates a AddCertificateCreated with default headers values
func NewAddCertificateCreated() *AddCertificateCreated {
	return &AddCertificateCreated{}
}

/*
AddCertificateCreated describes a response with status code 201, with default header values.

The certificate was successfully added.
*/
type AddCertificateCreated struct {
	Payload *models.APICertificate
}

// IsSuccess returns true when this add certificate created response has a 2xx status code
func (o *AddCertificateCreated) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this add certificate created response has a 3xx status code
func (o *AddCertificateCreated) IsRedirect() bool {
	return false
}

// IsClientError returns true when this add certificate created response has a 4xx status code
func (o *AddCertificateCreated) IsClientError() bool {
	return false
}

// IsServerError returns true when this add certificate created response has a 5xx status code
func (o *AddCertificateCreated) IsServerError() bool {
	return false
}

// IsCode returns true when this add certificate created response a status code equal to that given
func (o *AddCertificateCreated) IsCode(code int) bool {
	return code == 201
}

// Code gets the status code for the add certificate created response
func (o *AddCertificateCreated) Code() int {
	return 201
}

func (o *AddCertificateCreated) Error() string {
	return fmt.Sprintf("[POST /v1/security/ssl/truststore][%d] addCertificateCreated  %+v", 201, o.Payload)
}

func (o *AddCertificateCreated) String() string {
	return fmt.Sprintf("[POST /v1/security/ssl/truststore][%d] addCertificateCreated  %+v", 201, o.Payload)
}

func (o *AddCertificateCreated) GetPayload() *models.APICertificate {
	return o.Payload
}

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

	o.Payload = new(models.APICertificate)

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

	return nil
}

// NewAddCertificateForbidden creates a AddCertificateForbidden with default headers values
func NewAddCertificateForbidden() *AddCertificateForbidden {
	return &AddCertificateForbidden{}
}

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

Insufficient permissions to add certificate to the trust store.
*/
type AddCertificateForbidden struct {
}

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

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

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

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

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

// Code gets the status code for the add certificate forbidden response
func (o *AddCertificateForbidden) Code() int {
	return 403
}

func (o *AddCertificateForbidden) Error() string {
	return fmt.Sprintf("[POST /v1/security/ssl/truststore][%d] addCertificateForbidden ", 403)
}

func (o *AddCertificateForbidden) String() string {
	return fmt.Sprintf("[POST /v1/security/ssl/truststore][%d] addCertificateForbidden ", 403)
}

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

	return nil
}

// NewAddCertificateConflict creates a AddCertificateConflict with default headers values
func NewAddCertificateConflict() *AddCertificateConflict {
	return &AddCertificateConflict{}
}

/*
AddCertificateConflict describes a response with status code 409, with default header values.

The certificate already exists in the system.
*/
type AddCertificateConflict struct {
}

// IsSuccess returns true when this add certificate conflict response has a 2xx status code
func (o *AddCertificateConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this add certificate conflict response has a 3xx status code
func (o *AddCertificateConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this add certificate conflict response has a 4xx status code
func (o *AddCertificateConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this add certificate conflict response has a 5xx status code
func (o *AddCertificateConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this add certificate conflict response a status code equal to that given
func (o *AddCertificateConflict) IsCode(code int) bool {
	return code == 409
}

// Code gets the status code for the add certificate conflict response
func (o *AddCertificateConflict) Code() int {
	return 409
}

func (o *AddCertificateConflict) Error() string {
	return fmt.Sprintf("[POST /v1/security/ssl/truststore][%d] addCertificateConflict ", 409)
}

func (o *AddCertificateConflict) String() string {
	return fmt.Sprintf("[POST /v1/security/ssl/truststore][%d] addCertificateConflict ", 409)
}

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

	return nil
}
