forked from ZyntariHQ/Invoisio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraft.types.ts
More file actions
80 lines (75 loc) · 1.68 KB
/
Copy pathdraft.types.ts
File metadata and controls
80 lines (75 loc) · 1.68 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
* Draft invoice data structure for mobile
*/
export interface DraftInvoice {
id: string;
merchantId: string;
userId?: string;
invoiceNumber?: string;
clientName?: string;
clientEmail?: string;
description?: string;
amount?: number;
assetCode?: string;
assetIssuer?: string;
customerId?: string;
dueDate?: string | Date;
isDraft: boolean;
draftVersion: number;
lastAutoSavedAt?: string | Date;
createdAt: string | Date;
updatedAt: string | Date;
metadata?: Record<string, unknown>;
// Computed fields for UI
hasRequiredFields?: boolean;
completionPercentage?: number;
}
/**
* DTO for creating a new draft
*/
export interface CreateDraftDto {
invoiceNumber?: string | undefined;
clientName?: string | undefined;
clientEmail?: string | undefined;
description?: string | undefined;
amount?: number | undefined;
asset_code?: string | undefined;
asset_issuer?: string | undefined;
customer_id?: string | undefined;
due_date?: string | undefined;
metadata?: Record<string, unknown> | undefined;
}
/**
* DTO for updating a draft
*/
export interface UpdateDraftDto extends Partial<CreateDraftDto> {
id?: string;
autoSave?: boolean;
}
/**
* Paginated draft response
*/
export interface DraftListResponse {
items: DraftInvoice[];
total: number;
page: number;
pageSize: number;
hasMore: boolean;
}
/**
* Draft service response for discard operation
*/
export interface DiscardDraftResponse {
id: string;
discarded: boolean;
}
/**
* Local draft storage for offline support
*/
export interface LocalDraft {
id: string;
data: Partial<DraftInvoice>;
lastSavedAt: number;
isSynced: boolean;
pendingUpdates?: UpdateDraftDto;
}