package aws_facade

import "context"

const JobStatusForbiddenMsg = "job status forbidden"

// BatchOpsClient defines the interface for interacting with AWS S3 Batch Operations.
// It is intentionally minimal for the backup export workflow demo.
type BatchOpsClient interface {
	GenerateAndUploadManifest(ctx context.Context, region, accountID, sourceBucket, sourcePrefix, manifestBucket, manifestKey string) (etag string, err error)
	UploadManifest(ctx context.Context, region, accountID, bucket, key, content string) (etag string, err error)
	CreateCopyJob(ctx context.Context, region string, params *CreateCopyJobParams) (jobID string, err error)
	DescribeJob(ctx context.Context, region, accountID, jobID string) (*JobStatus, error)
	CancelJob(ctx context.Context, region, accountID, jobID string) error
	GenerateServiceRole(ctx context.Context, accountID string, projectId, clusterId uint64) string
}

type CreateCopyJobParams struct {
	AccountID string // AWS account that owns the source bucket and runs the batch job
	RoleARN   string // IAM role assumed by S3 Batch Operations
	CannedACL string // Canned ACL applied to the copied objects, Empty means omit ACL (for BucketOwnerEnforced).

	ManifestBucket string // Bucket where the manifest file is uploaded
	ManifestKey    string // Path of the manifest file under the bucket
	ManifestETag   string // ETag of the manifest file after being uploaded

	ReportBucket string // Bucket where the batchOps report is stored
	ReportPrefix string // SubDirectory of the batchOps reports under the bucket

	TargetBucketARN string // ARN of the export-destination bucket
	TargetKeyPrefix string // SubDirectory of the copied objects under the target bucket
}

type JobStatus struct {
	Status string

	Total     int64
	Succeeded int64
	Failed    int64

	Message string
}
