//
//  PlaybackTracking.swift
//  SodaLive
//
//  Created by klaus on 2023/08/11.
//

import Foundation
import ObjectBox

class PlaybackTracking: Entity {
    var id: Id = 0
    var audioContentId: Int
    var totalDuration: Int
    var startPosition: Int
    var isFree: Bool
    var isPreview: Bool
    var endPosition: Int? = nil
    var playDateTime: String = Date().convertDateFormat(dateFormat: "yyyy-MM-dd HH:mm:ss")
    
    required init() {
        audioContentId = 0
        totalDuration = 0
        startPosition = 0
        isFree = true
        isPreview = true
        endPosition = nil
    }
    
    convenience init(
        audioContentId: Int,
        totalDuration: Int,
        startPosition: Int,
        isFree: Bool,
        isPreview: Bool
    ) {
        self.init()
        self.audioContentId = audioContentId
        self.totalDuration = totalDuration
        self.startPosition = startPosition
        self.isFree = isFree
        self.isPreview = isPreview
    }
}
