import Foundation
import GRDB

nonisolated struct PlaylistTrack: Codable, Identifiable, Equatable, Hashable, Sendable {
    var id: Int64?
    var playlistId: Int64
    var trackId: Int64
    var position: Int
}

nonisolated extension PlaylistTrack: FetchableRecord, MutablePersistableRecord {
    static let databaseTableName = "playlist_tracks"

    mutating func didInsert(_ inserted: InsertionSuccess) {
        id = inserted.rowID
    }
}
