package domain

import "github.com/tidbcloud/dataflow-service/app/repo/entity"

// EnableCRRFReq is the request for enabling CRRF (Cross-Region Replication based Failover).
type EnableCRRFReq struct {
	ClusterID       uint64
	TenantID        uint64
	ProjectID       uint64
	SecondaryRegion string

	// SkipEnablePiTRAndDualRegion instructs the enable_crrf DAG to skip the
	// enable_pitr and enable_dual_region steps. Set this to true when EnableCRRF
	// is called from within a PiTR or dual-region enable DAG to prevent a
	// deadlock: those two steps would otherwise attempt to trigger new enable
	// DAGs that conflict with the already-running parent DAG.
	SkipEnablePiTRAndDualRegion bool
}

// DisableCRRFReq is the request for disabling CRRF.
type DisableCRRFReq struct {
	ClusterID uint64
	TenantID  uint64
	ProjectID uint64
}

// CRRFInfo holds the CRRF status and recovery-point information for a cluster.
type CRRFInfo struct {
	ClusterID         uint64
	Status            entity.CRRFSettingStatus
	MasterRegion      string
	SecondaryRegion   string
	MasterBucketID    uint64
	SecondaryBucketID uint64

	// Non-empty when the last enable attempt failed.
	ErrorMessage string
}
