package tidbtools

// ChangefeedSummary mirrors `ChangefeedSummary` in FE types — a small
// projection used only by the Tools-page overview to surface count +
// latest health. Full Changefeed details remain on the
// `cloudconfig.ListInternalChangefeeds` endpoint.
type ChangefeedSummary struct {
	ID          string           `json:"id"`
	DisplayName string           `json:"display_name"`
	Status      ChangefeedStatus `json:"status" enums:"creating,normal,starting,stopping,stopped,scaling,editing,warning,error,failed,deleting,deleted,finished"`
}

// ListChangefeedsOverviewResp is the response body for the changefeed
// summary slice consumed by the Tools overview panel.
type ListChangefeedsOverviewResp struct {
	Items []*ChangefeedSummary `json:"items"`
	Total int64                `json:"total"`
}

// GetOverviewResp is the response body for `GET .../overview`.
//
// It is a thin aggregator: each pointer is nil when the corresponding
// sub-tool is either not applicable to the cluster type (e.g. Backup on
// a Premium cluster) or not yet implemented upstream. FE renders
// whichever sections are present.
type GetOverviewResp struct {
	DMOverview      *DMOverview                  `json:"dm_overview,omitempty"`
	DMJobs          *ListDMJobsResp              `json:"dm_jobs,omitempty"`
	Imports         *ListImportsResp             `json:"imports,omitempty"`
	ImportIntoTasks *ListImportIntoTasksResp     `json:"import_into_tasks,omitempty"`
	Backups         *ListBackupsResp             `json:"backups,omitempty"`
	LogBackups      *ListLogBackupsResp          `json:"log_backups,omitempty"`
	BackupExports   *ListBackupExportsResp       `json:"backup_exports,omitempty"`
	Exports         *ListExportsResp             `json:"exports,omitempty"`
	Restores        *ListRestoresResp            `json:"restores,omitempty"`
	Changefeeds     *ListChangefeedsOverviewResp `json:"changefeeds,omitempty"`
	// Warnings collects non-fatal errors from individual fan-out calls,
	// so the overview never fails entirely because one tool is down.
	Warnings []string `json:"warnings,omitempty"`
}
