import Foundation
import ImageCaptureCore

/// USB Vendor ID 常量，用于自动识别相机品牌。
enum CameraUSBVendorID {
    static let sony: Int = 0x054C
    static let canon: Int = 0x04A9
    static let nikon: Int = 0x04B0
}

extension CameraBrand {
    /// 根据 ICCameraDevice 的 USB Vendor ID 识别品牌。
    static func detect(from camera: ICCameraDevice) -> CameraBrand? {
        switch Int(camera.usbVendorID) {
        case CameraUSBVendorID.sony:
            return .sony
        case CameraUSBVendorID.canon:
            return .canon
        case CameraUSBVendorID.nikon:
            return .nikon
        default:
            return nil
        }
    }
}
