package com.rugvedsarika.cashcounter.data

import androidx.room.Entity
import androidx.room.PrimaryKey
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale

@Entity(tableName = "history_table")
data class HistoryEntity(
    @PrimaryKey(autoGenerate = true)
    val id: Int = 0,
    val timestamp: Long,
    val totalAmount: Int,
    val breakdown: String, // Stored as "500x2, 100x5" etc.
    val remarks: String? = null
) {
    fun getFormattedDate(): String {
        return SimpleDateFormat("dd MMM yyyy, hh:mm a", Locale.forLanguageTag("en-IN")).format(Date(timestamp))
    }
}
