File size: 2,389 Bytes
46463e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
81
82
83
84
85
86
87
88
89
90
91
92
/**
 * @license
 * SPDX-License-Identifier: Apache-2.0
 */

export type StaffRole = 'owner' | 'manager' | 'cashier';

export interface StaffUser {
  id: string;
  name: string;
  email: string;
  role: StaffRole;
  active: boolean;
}

export interface TireProduct {
  id: string;
  sku: string;
  brand: string;
  model: string;
  size: string; // e.g., 195/65 R15
  category: 'Passenger' | 'SUV' | 'Commercial' | 'Light Truck' | 'Truck/Bus';
  stock: number;
  minStock: number; // Alerts triggered when stock <= minStock
  price: number; // Selling price
  purchasePrice: number; // Cost price (for profit computation)
  description?: string;
}

export interface StockHistoryItem {
  id: string;
  productId: string;
  productLabel: string; // Saved snapshot for history search resilience
  dateTime: string;
  type: 'STOCK_IN' | 'STOCK_OUT' | 'MANUAL_ADJUSTMENT';
  quantity: number; // Signed or unsigned change
  resultingStock: number;
  adjustedBy: string; // Staff user name/role
  reason: string;
}

export interface InvoiceLineItem {
  id: string;
  productId: string;
  brand: string;
  model: string;
  size: string;
  quantity: number;
  unitPrice: number;
  totalPrice: number;
}

export interface Invoice {
  id: string;
  invoiceNumber: string; // e.g. HBT-2026-1001
  dateTime: string;
  customerName: string;
  customerPhone: string;
  customerVehicle?: string; // Car model / registration number (highly relevant for a tire shop!)
  items: InvoiceLineItem[];
  subtotal: number;
  taxRate: number; // e.g., 17 for 17%
  taxAmount: number;
  discount: number;
  total: number;
  currencySymbol: string;
  currencyCode: string;
  paymentMethod: 'CASH' | 'CARD' | 'BANK_TRANSFER' | 'MOBILE_WALLET';
  paymentStatus: 'PAID' | 'UNPAID' | 'PARTIAL';
  amountPaid: number;
  gatewayInfo?: {
    gatewayName: 'Stripe' | 'PayPal' | 'EasyPaisa' | 'JazzCash' | 'Bank';
    transactionId: string;
    authTime: string;
  };
  cashierName: string;
  notes?: string;
  isOfflineCreated?: boolean; // Tracking for offline-first resilience
}

export interface SystemSettings {
  shopName: string;
  shopAddress: string;
  shopPhone: string;
  taxName: string; // e.g., "GST" or "VAT" or "Sales Tax"
  taxRate: number; // Percentage
  currencyCode: string; // PKR, USD, EUR etc.
  currencySymbol: string; // ₨, $, € etc.
  stripePublicKey?: string;
  easyPaisaMerchantId?: string;
}