-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
55 lines (47 loc) · 1.61 KB
/
types.ts
File metadata and controls
55 lines (47 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
export enum FileProcessingStatus {
IDLE = 'idle',
QUEUED = 'queued', // Waiting in the upload queue
UPLOADING = 'uploading',
PROCESSING = 'processing',
SUCCESS = 'success',
ERROR = 'error',
}
export type ReviewStatus = 'pending' | 'reviewed';
// A value with its location data
export interface GroundedValue {
value?: string;
// Normalized coordinates of the bounding polygon
boundingPoly?: Array<{ x: number; y: number; }>;
}
// A single field definition in a configuration
export interface FieldConfig {
key: string; // e.g., faturaNumarasi
label: string; // e.g., Fatura Numarası
}
// Configuration for a document type
export interface InvoiceConfig {
id: string;
name: string;
isPredefined: boolean; // Cannot be deleted if true
fields: FieldConfig[]; // Main fields
lineItemFields?: FieldConfig[]; // Fields for line items/KDV details
}
// The data extracted for an invoice. A flexible key-value store.
export interface ExtractedInvoiceFields {
[key: string]: GroundedValue | undefined;
}
// The processed invoice object
export interface ProcessedInvoice {
id: string;
fileName: string;
fileType: string;
status: FileProcessingStatus;
reviewStatus?: ReviewStatus;
extractedData?: ExtractedInvoiceFields;
lineItems?: Array<{ [key: string]: GroundedValue | undefined }>; // For KDV details or other line items
errorMessage?: string;
configId: string; // Which configuration was used
customFields?: FieldConfig[]; // User-added fields during review
customLineItemFields?: FieldConfig[]; // User-added line item fields
}
export type AlertType = 'success' | 'error' | 'info' | 'warning';