import { DateTime } from 'luxon'
import { column, computed } from '@ioc:Adonis/Lucid/Orm'
import Episode from './Episode'
import Series from './Series'
import AppBaseModel from './AppBaseModel'

export default class PlayHistory 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()
    public seriesId: number

    @column()
    public episodeId: number

    @column()
    public duration: number

    @computed()
    public series?: Series

    @computed()
    public episode?: Episode
}
