package org.octopus.internal.db.entities

import jakarta.persistence.Convert
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue
import jakarta.persistence.GenerationType
import jakarta.persistence.Id
import org.octopus.internal.common.enums.EEntryType
import org.octopus.internal.db.converters.MonthListConverter
import java.time.Month
import java.util.Date

@Entity(name = "data_entries")
data class EntryEntity(
    @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
    var id: Long = 0L,
    val name: String,
    val type: EEntryType,
    val amount: Double,
    val fixedDate: Date? = null,
    val recurrent: Boolean? = false,
    @field:Convert(converter = MonthListConverter::class)
    val recurrentMonths: List<Month>? = mutableListOf(),
    val startDate: Date? = null,
    val endDate: Date? = null,
    val color: String
)