// Package services provides TUI service clients
package services

import (
	"fmt"
	"time"

	"github.com/jfraeys/fetch_ml/internal/logging"
)

// ExportService handles job export functionality for TUI
type ExportService struct {
	serverURL string
	apiKey    string
	logger    *logging.Logger
}

// NewExportService creates a new export service
func NewExportService(serverURL, apiKey string, logger *logging.Logger) *ExportService {
	return &ExportService{
		serverURL: serverURL,
		apiKey:    apiKey,
		logger:    logger,
	}
}

// ExportJob exports a job with optional anonymization
// Returns the path to the exported file
func (s *ExportService) ExportJob(jobName string, anonymize bool) (string, error) {
	s.logger.Info("exporting job", "job", jobName, "anonymize", anonymize)

	// Placeholder - actual implementation would call API
	// POST /api/jobs/{id}/export?anonymize=true

	exportPath := fmt.Sprintf("/tmp/%s_export_%d.tar.gz", jobName, time.Now().Unix())

	s.logger.Info("export complete", "job", jobName, "path", exportPath)
	return exportPath, nil
}

// ExportOptions contains options for export
type ExportOptions struct {
	Anonymize   bool
	IncludeLogs bool
	IncludeData bool
}
