import type { StorefrontCaseAttachmentPurpose, StorefrontCaseEvidenceText, StorefrontDisputeDeadlinePolicy } from "../core/aftercare"; import type { PaymentDisputeEvidenceFile, PaymentDisputeEvidenceReconciliation, PaymentDisputeEvidenceResult } from "../core/payment"; import type { CommerceDb } from "./queries"; import { commerceStorefrontCaseAttachments, commerceStorefrontCaseEvidenceSubmissions, commerceStorefrontCases } from "./index"; export type StorefrontCaseAttachmentRecord = typeof commerceStorefrontCaseAttachments.$inferSelect; export type StorefrontCaseEvidenceSubmission = typeof commerceStorefrontCaseEvidenceSubmissions.$inferSelect; type InspectionResult = { details?: string; scanner: string; signature?: string; verdict: "clean" | "infected" | "unavailable"; }; export declare const normalizeStorefrontDisputeDeadlinePolicy: (policy: StorefrontDisputeDeadlinePolicy) => StorefrontDisputeDeadlinePolicy; export declare const createStorefrontAftercareEvidenceService: (options: { attachmentsEnabled?: boolean; db: CommerceDb; deadlinesEnabled?: boolean; deadlineWindowMs?: number; evidenceEnabled?: boolean; inspectAttachment: (attachment: StorefrontCaseAttachmentRecord) => Promise; leaseMs?: number; now?: () => Date; removeAttachment: (attachment: StorefrontCaseAttachmentRecord) => Promise; reconcileEvidence?: (input: { attachments: StorefrontCaseAttachmentRecord[]; caseEntry: typeof commerceStorefrontCases.$inferSelect; submission: StorefrontCaseEvidenceSubmission; }) => Promise; submitEvidence: (input: { attachments: StorefrontCaseAttachmentRecord[]; caseEntry: typeof commerceStorefrontCases.$inferSelect; idempotencyKey: string; submission: StorefrontCaseEvidenceSubmission; }) => Promise; }) => { deleteAttachment: (ownerKey: string, attachmentId: string) => Promise<{ blob_key: string; byte_count: number; case_id: string; content_type: string; created_at: Date; id: string; internal: boolean; label: string; last_error: string | null; lease_expires_at: Date | null; owner_key: string; purpose: StorefrontCaseAttachmentPurpose; retention_expires_at: Date | null; scan_details: string | null; scan_provider: string | null; scanned_at: Date | null; sha256: string; status: import("..").StorefrontCaseAttachmentStatus; updated_at: Date; worker_id: string | null; }>; getCustomerAttachment: (ownerKey: string, access: { accessToken: string; checkoutIntentId: string; }, attachmentId: string) => Promise<{ blob_key: string; byte_count: number; case_id: string; content_type: string; created_at: Date; id: string; internal: boolean; label: string; last_error: string | null; lease_expires_at: Date | null; owner_key: string; purpose: StorefrontCaseAttachmentPurpose; retention_expires_at: Date | null; scan_details: string | null; scan_provider: string | null; scanned_at: Date | null; sha256: string; status: import("..").StorefrontCaseAttachmentStatus; updated_at: Date; worker_id: string | null; }>; getOwnerAttachment: (ownerKey: string, attachmentId: string) => Promise<{ blob_key: string; byte_count: number; case_id: string; content_type: string; created_at: Date; id: string; internal: boolean; label: string; last_error: string | null; lease_expires_at: Date | null; owner_key: string; purpose: StorefrontCaseAttachmentPurpose; retention_expires_at: Date | null; scan_details: string | null; scan_provider: string | null; scanned_at: Date | null; sha256: string; status: import("..").StorefrontCaseAttachmentStatus; updated_at: Date; worker_id: string | null; }>; listCustomer: (ownerKey: string, access: { accessToken: string; checkoutIntentId: string; }) => Promise; listFleet: () => Promise<{ attachments: { blob_key: string; byte_count: number; case_id: string; content_type: string; created_at: Date; id: string; internal: boolean; label: string; last_error: string | null; lease_expires_at: Date | null; owner_key: string; purpose: StorefrontCaseAttachmentPurpose; retention_expires_at: Date | null; scan_details: string | null; scan_provider: string | null; scanned_at: Date | null; sha256: string; status: import("..").StorefrontCaseAttachmentStatus; updated_at: Date; worker_id: string | null; }[]; submissions: { attachment_ids: string[]; attempts: number; case_id: string; created_at: Date; evidence: Partial<{ accessActivityLog: string; billingAddress: string; cancellationPolicyDisclosure: string; cancellationRebuttal: string; customerEmailAddress: string; customerName: string; customerPurchaseIp: string; duplicateChargeExplanation: string; duplicateChargeId: string; productDescription: string; refundPolicyDisclosure: string; refundRefusalExplanation: string; serviceDate: string; shippingAddress: string; shippingCarrier: string; shippingDate: string; shippingTrackingNumber: string; uncategorizedText: string; }>; id: string; idempotency_key: string; last_error: string | null; lease_expires_at: Date | null; next_attempt_at: Date | null; owner_key: string; provider_file_ids: Record; provider_status: string | null; reconciliation_diagnostics: import("..").PaymentDisputeEvidenceReconciliationDiagnostics | null; reconciled_at: Date | null; submission_count: number | null; submit: boolean; status: import("..").StorefrontCaseEvidenceStatus; submitted_at: Date | null; updated_at: Date; worker_id: string | null; }[]; deadlinePolicies: { deadline_policy: StorefrontDisputeDeadlinePolicy; created_at: Date; owner_key: string; updated_at: Date; }[]; }>; listOwner: (ownerKey: string) => Promise<{ attachments: { blob_key: string; byte_count: number; case_id: string; content_type: string; created_at: Date; id: string; internal: boolean; label: string; last_error: string | null; lease_expires_at: Date | null; owner_key: string; purpose: StorefrontCaseAttachmentPurpose; retention_expires_at: Date | null; scan_details: string | null; scan_provider: string | null; scanned_at: Date | null; sha256: string; status: import("..").StorefrontCaseAttachmentStatus; updated_at: Date; worker_id: string | null; }[]; submissions: { attachment_ids: string[]; attempts: number; case_id: string; created_at: Date; evidence: Partial<{ accessActivityLog: string; billingAddress: string; cancellationPolicyDisclosure: string; cancellationRebuttal: string; customerEmailAddress: string; customerName: string; customerPurchaseIp: string; duplicateChargeExplanation: string; duplicateChargeId: string; productDescription: string; refundPolicyDisclosure: string; refundRefusalExplanation: string; serviceDate: string; shippingAddress: string; shippingCarrier: string; shippingDate: string; shippingTrackingNumber: string; uncategorizedText: string; }>; id: string; idempotency_key: string; last_error: string | null; lease_expires_at: Date | null; next_attempt_at: Date | null; owner_key: string; provider_file_ids: Record; provider_status: string | null; reconciliation_diagnostics: import("..").PaymentDisputeEvidenceReconciliationDiagnostics | null; reconciled_at: Date | null; submission_count: number | null; submit: boolean; status: import("..").StorefrontCaseEvidenceStatus; submitted_at: Date | null; updated_at: Date; worker_id: string | null; }[]; deadlinePolicy: StorefrontDisputeDeadlinePolicy; }>; setDeadlinePolicy: (ownerKey: string, policy: StorefrontDisputeDeadlinePolicy) => Promise<{ created_at: Date; owner_key: string; updated_at: Date; deadline_policy: StorefrontDisputeDeadlinePolicy; }>; queueEvidence: (input: { attachmentIds: string[]; caseId: string; evidence: StorefrontCaseEvidenceText; idempotencyKey: string; ownerKey: string; submit: boolean; }) => Promise<{ id: string; created_at: Date; status: import("..").StorefrontCaseEvidenceStatus; owner_key: string; updated_at: Date; last_error: string | null; attempts: number; case_id: string; idempotency_key: string; lease_expires_at: Date | null; next_attempt_at: Date | null; worker_id: string | null; provider_status: string | null; attachment_ids: string[]; evidence: Partial<{ accessActivityLog: string; billingAddress: string; cancellationPolicyDisclosure: string; cancellationRebuttal: string; customerEmailAddress: string; customerName: string; customerPurchaseIp: string; duplicateChargeExplanation: string; duplicateChargeId: string; productDescription: string; refundPolicyDisclosure: string; refundRefusalExplanation: string; serviceDate: string; shippingAddress: string; shippingCarrier: string; shippingDate: string; shippingTrackingNumber: string; uncategorizedText: string; }>; provider_file_ids: Record; reconciliation_diagnostics: import("..").PaymentDisputeEvidenceReconciliationDiagnostics | null; reconciled_at: Date | null; submission_count: number | null; submit: boolean; submitted_at: Date | null; }>; retainCustomerAttachment: (input: { accessToken: string; blobKey: string; byteCount: number; caseId: string; checkoutIntentId: string; contentType: string; label: string; ownerKey: string; purpose?: StorefrontCaseAttachmentPurpose; retentionExpiresAt?: Date | null; sha256: string; }) => Promise<{ id: string; purpose: StorefrontCaseAttachmentPurpose; sha256: string; created_at: Date; status: import("..").StorefrontCaseAttachmentStatus; label: string; owner_key: string; updated_at: Date; last_error: string | null; case_id: string; lease_expires_at: Date | null; worker_id: string | null; internal: boolean; blob_key: string; byte_count: number; content_type: string; retention_expires_at: Date | null; scan_details: string | null; scan_provider: string | null; scanned_at: Date | null; }>; retainOperatorAttachment: (input: { blobKey: string; byteCount: number; caseId: string; contentType: string; internal?: boolean; label: string; ownerKey: string; purpose?: StorefrontCaseAttachmentPurpose; retentionExpiresAt?: Date | null; sha256: string; }) => Promise<{ id: string; purpose: StorefrontCaseAttachmentPurpose; sha256: string; created_at: Date; status: import("..").StorefrontCaseAttachmentStatus; label: string; owner_key: string; updated_at: Date; last_error: string | null; case_id: string; lease_expires_at: Date | null; worker_id: string | null; internal: boolean; blob_key: string; byte_count: number; content_type: string; retention_expires_at: Date | null; scan_details: string | null; scan_provider: string | null; scanned_at: Date | null; }>; retryAttachment: (ownerKey: string, attachmentId: string) => Promise<{ blob_key: string; byte_count: number; case_id: string; content_type: string; created_at: Date; id: string; internal: boolean; label: string; last_error: string | null; lease_expires_at: Date | null; owner_key: string; purpose: StorefrontCaseAttachmentPurpose; retention_expires_at: Date | null; scan_details: string | null; scan_provider: string | null; scanned_at: Date | null; sha256: string; status: import("..").StorefrontCaseAttachmentStatus; updated_at: Date; worker_id: string | null; }>; queueEvidenceReconciliation: (ownerKey: string, submissionId: string) => Promise<{ attachment_ids: string[]; attempts: number; case_id: string; created_at: Date; evidence: Partial<{ accessActivityLog: string; billingAddress: string; cancellationPolicyDisclosure: string; cancellationRebuttal: string; customerEmailAddress: string; customerName: string; customerPurchaseIp: string; duplicateChargeExplanation: string; duplicateChargeId: string; productDescription: string; refundPolicyDisclosure: string; refundRefusalExplanation: string; serviceDate: string; shippingAddress: string; shippingCarrier: string; shippingDate: string; shippingTrackingNumber: string; uncategorizedText: string; }>; id: string; idempotency_key: string; last_error: string | null; lease_expires_at: Date | null; next_attempt_at: Date | null; owner_key: string; provider_file_ids: Record; provider_status: string | null; reconciliation_diagnostics: import("..").PaymentDisputeEvidenceReconciliationDiagnostics | null; reconciled_at: Date | null; submission_count: number | null; submit: boolean; status: import("..").StorefrontCaseEvidenceStatus; submitted_at: Date | null; updated_at: Date; worker_id: string | null; }>; retryEvidence: (ownerKey: string, submissionId: string) => Promise<{ attachment_ids: string[]; attempts: number; case_id: string; created_at: Date; evidence: Partial<{ accessActivityLog: string; billingAddress: string; cancellationPolicyDisclosure: string; cancellationRebuttal: string; customerEmailAddress: string; customerName: string; customerPurchaseIp: string; duplicateChargeExplanation: string; duplicateChargeId: string; productDescription: string; refundPolicyDisclosure: string; refundRefusalExplanation: string; serviceDate: string; shippingAddress: string; shippingCarrier: string; shippingDate: string; shippingTrackingNumber: string; uncategorizedText: string; }>; id: string; idempotency_key: string; last_error: string | null; lease_expires_at: Date | null; next_attempt_at: Date | null; owner_key: string; provider_file_ids: Record; provider_status: string | null; reconciliation_diagnostics: import("..").PaymentDisputeEvidenceReconciliationDiagnostics | null; reconciled_at: Date | null; submission_count: number | null; submit: boolean; status: import("..").StorefrontCaseEvidenceStatus; submitted_at: Date | null; updated_at: Date; worker_id: string | null; }>; runDeadlineCycle: (limit?: number) => Promise<{ bucket: string; caseId: string; }[]>; runReconciliationCycle: (workerId: string, limit?: number) => Promise<{ status: string; submissionId: string; }[]>; runEvidenceCycle: (workerId: string, limit?: number) => Promise<{ status: string; submissionId: string; }[]>; runInspectionCycle: (workerId: string, limit?: number) => Promise<{ attachmentId: string; status: string; }[]>; runRetentionCycle: (limit?: number) => Promise; }; export declare const storefrontEvidenceFiles: (input: { attachments: StorefrontCaseAttachmentRecord[]; read: (attachment: StorefrontCaseAttachmentRecord) => Promise; }) => Promise; export {};