/*
 * SPDX-FileCopyrightText: Sebastiano Barezzi
 * SPDX-License-Identifier: Apache-2.0
 */

package com.xyzshell.andinfo.libs.gpu.utils

import com.xyzshell.andinfo.libs.gpu.models.VkApiVersion
import com.xyzshell.andinfo.libs.gpu.models.VkPhysicalDevice
import com.xyzshell.andinfo.libs.gpu.models.VkVersion

object VkUtils {
    class VkPhysicalDevices : ArrayList<VkPhysicalDevice>() {
        fun addDevice(
            apiVersion: Long,
            driverVersion: Long,
            vendorId: Long,
            deviceId: Long,
            deviceType: Long,
            deviceName: String,
        ) = add(
            VkPhysicalDevice(
                apiVersion = VkVersion(apiVersion.toInt()),
                driverVersion = driverVersion,
                vendorId = vendorId,
                registeredVendorId = com.xyzshell.andinfo.libs.gpu.models.VkVendorId.fromId(vendorId),
                deviceId = deviceId,
                deviceType = com.xyzshell.andinfo.libs.gpu.models.VkPhysicalDeviceType.fromValue(deviceType) ?: com.xyzshell.andinfo.libs.gpu.models.VkPhysicalDeviceType.OTHER,
                deviceName = deviceName,
            )
        )
    }

    external fun getVkInfo(): VkPhysicalDevices?
}
