package usecase import ( "context" "io" "time" "cmroubao/backend-api/internal/domain" ) type Clock interface { Now() time.Time } type IDGenerator interface { NewID() (string, error) } type NormalizedReferenceImage struct { StorageKey string InputMediaType string InputSHA256 string MediaType string SizeBytes int64 SHA256 string } type ReferenceImageStore interface { Put( context.Context, string, string, io.Reader, ) (NormalizedReferenceImage, error) Open(context.Context, string) (io.ReadCloser, error) Delete(context.Context, string) error } type AssetRepository interface { CreateAssetIdempotent( context.Context, domain.Asset, string, string, ) (domain.Asset, bool, error) GetAsset( context.Context, string, string, ) (domain.Asset, error) } type TaskCursor struct { CreatedAt time.Time ID string } type TaskListFilter struct { CreatorSubject string Status *domain.TaskStatus Query string CreatedFrom *time.Time CreatedTo *time.Time Limit int After *TaskCursor } type TaskRepository interface { CreateTaskIdempotent( context.Context, domain.PurchaseTask, domain.TaskEvent, string, string, ) (domain.PurchaseTask, bool, error) ListTasks( context.Context, TaskListFilter, ) ([]domain.PurchaseTask, error) GetTaskDetail( context.Context, string, string, ) (domain.TaskDetail, error) CancelTask( context.Context, string, string, string, time.Time, domain.TaskEvent, ) (domain.PurchaseTask, error) }