package gcp_facade

import (
	"context"
	"time"

	"cloud.google.com/go/iam"
)

type NonRetryableError struct {
	Err error
}

func (e *NonRetryableError) Error() string {
	return e.Err.Error()
}

// GCPStorageTransferClient defines the interface for interacting with GCP Storage Transfer Service
type GCPStorageTransferClient interface {
	GetServiceAccount(ctx context.Context, projectID string) (string, error)
	GrantPermissionToSAOnBucket(ctx context.Context, bucketName, serviceAccount string, roles []iam.RoleName) error
	CreateOneTimeTransferJob(ctx context.Context, params *TransferJobParams) (string, error)
	CancelOneTimeTransferJob(ctx context.Context, projectID, jobID string) error
	GetOneTimeTransferJobStatus(ctx context.Context, projectID, jobID string) (*TransferJobStatus, error)
}

// TransferJobParams contains parameters for creating a transfer job
type TransferJobParams struct {
	JobName        string
	JobDescription string
	ProjectID      string
	SourceBucket   string
	SourcePath     string
	TargetBucket   string
	TargetPath     string
	RunAt          time.Time
}

// TransferJobStatus represents the status of a transfer job
type TransferJobStatus struct {
	Completed bool
	Failed    bool
	Message   string
}
