import { DateTime } from 'luxon'
import { column } from '@ioc:Adonis/Lucid/Orm'
import Decimal from 'decimal.js'
import { decimalConverter } from 'App/Helpers/db'
import AppBaseModel from './AppBaseModel'

export default class UserBalance extends AppBaseModel {
    @column({ isPrimary: true })
    public id: number

    @column.dateTime({ autoCreate: true })
    public createdAt: DateTime

    @column.dateTime({ autoCreate: true, autoUpdate: true })
    public updatedAt: DateTime

    @column()
    public userId: number

    @column({ ...decimalConverter })
    public balance: Decimal

    @column({ ...decimalConverter })
    public lastBalance: Decimal
}
