package com.example.barokahstore.data

data class User(
    val id: Int,
    val username: String,
    val name: String,
    val role: String // 'admin' or 'kasir'
)

data class Category(
    val id: Int,
    val name: String
)

data class Product(
    val id: Int,
    val barcode: String,
    val name: String,
    val buyPrice: Double,
    val sellPrice: Double,
    val stock: Int,
    val unit: String,
    val categoryId: Int?,
    val categoryName: String? = null
)

data class Transaction(
    val id: Int,
    val invoiceNo: String,
    val userId: Int,
    val cashierName: String,
    val totalAmount: Double,
    val discount: Double,
    val grandTotal: Double,
    val pay: Double,
    val changeAmount: Double,
    val paymentType: String, // 'cash' or 'piutang'
    val customerName: String?,
    val dueDate: String?,
    val status: String, // 'paid' or 'unpaid'
    val createdAt: String
)

data class TransactionDetail(
    val id: Int,
    val transactionId: Int,
    val productId: Int?,
    val productName: String,
    val price: Double,
    val qty: Int,
    val subtotal: Double
)

data class Receivable(
    val id: Int,
    val transactionId: Int?,
    val invoiceNo: String,
    val customerName: String,
    val totalAmount: Double,
    val paidAmount: Double,
    val dueDate: String?,
    val notes: String?,
    val status: String, // 'unpaid', 'partial', 'paid'
    val paidBy: String?,
    val createdAt: String
)

data class ReceivablePayment(
    val id: Int,
    val receivableId: Int,
    val payAmount: Double,
    val paymentDate: String,
    val note: String?
)

data class Attendance(
    val id: Int,
    val userId: Int,
    val userName: String,
    val checkIn: String,
    val checkOut: String?,
    val date: String,
    val status: String, // 'present', 'late', 'absent'
    val notes: String?
)

data class Settings(
    val id: Int,
    val storeName: String,
    val storeAddress: String,
    val storePhone: String,
    val receiptHeader: String,
    val receiptFooter: String,
    val lowStockThreshold: Int
)

data class SalesReport(
    val date: String,
    val revenue: Double,
    val cost: Double,
    val profit: Double
)

data class BestSellerProduct(
    val productName: String,
    val totalQty: Int,
    val revenue: Double
)
