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

package replication_service

// 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/pingcap/test-infra/sdk/dbaas_central/models"
)

// DetachReplicationReader is a Reader for the DetachReplication structure.
type DetachReplicationReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *DetachReplicationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewDetachReplicationOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	default:
		result := NewDetachReplicationDefault(response.Code())
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		if response.Code()/100 == 2 {
			return result, nil
		}
		return nil, result
	}
}

// NewDetachReplicationOK creates a DetachReplicationOK with default headers values
func NewDetachReplicationOK() *DetachReplicationOK {
	return &DetachReplicationOK{}
}

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

A successful response.
*/
type DetachReplicationOK struct {
	Payload *models.DataflowDetachReplicationResp
}

func (o *DetachReplicationOK) Error() string {
	return fmt.Sprintf("[DELETE /api/v1/orgs/{org_id}/clusters/{cluster_id}/replications/{rep_id}/type/{detach_type}][%d] detachReplicationOK  %+v", 200, o.Payload)
}
func (o *DetachReplicationOK) GetPayload() *models.DataflowDetachReplicationResp {
	return o.Payload
}

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

	o.Payload = new(models.DataflowDetachReplicationResp)

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

	return nil
}

// NewDetachReplicationDefault creates a DetachReplicationDefault with default headers values
func NewDetachReplicationDefault(code int) *DetachReplicationDefault {
	return &DetachReplicationDefault{
		_statusCode: code,
	}
}

/* DetachReplicationDefault describes a response with status code -1, with default header values.

An unexpected error response.
*/
type DetachReplicationDefault struct {
	_statusCode int

	Payload *models.RuntimeError
}

// Code gets the status code for the detach replication default response
func (o *DetachReplicationDefault) Code() int {
	return o._statusCode
}

func (o *DetachReplicationDefault) Error() string {
	return fmt.Sprintf("[DELETE /api/v1/orgs/{org_id}/clusters/{cluster_id}/replications/{rep_id}/type/{detach_type}][%d] DetachReplication default  %+v", o._statusCode, o.Payload)
}
func (o *DetachReplicationDefault) GetPayload() *models.RuntimeError {
	return o.Payload
}

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

	o.Payload = new(models.RuntimeError)

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

	return nil
}
