use amd_smi_wrapper::metrics::asic_info::AmdAsicInfo;
use amd_smi_wrapper::metrics::power_info::AmdPowerInfo;
use amd_smi_wrapper::metrics::process_info::{AmdProcessEngineUsage, AmdProcessInfo, AmdProcessMemoryUsage};
use amd_smi_wrapper::metrics::{AmdEnergyConsumption, AmdEngineUsage, AmdMemoryType, AmdTemperatureType};

pub const MOCK_SOURCE_NAME: &str = "amd_gpu_devices";
pub const MOCK_TIMESTAMP: u64 = 1712024507665;
pub const MOCK_UUID: &str = "a4ff740f-0000-1000-80ea-e05c945bb3b2";
pub const MOCK_PROCESS_NAME: &str = "p1";

pub const MOCK_VOLTAGE: i64 = 850;

pub const MOCK_ACTIVITY: AmdEngineUsage = AmdEngineUsage {
    gfx_activity: 131072,
    mm_activity: 262144,
    umc_activity: 524288,
};

pub const MOCK_ENERGY_RESOLUTION: f32 = 15.3;

pub const MOCK_ENERGY: [AmdEnergyConsumption; 2] = [
    AmdEnergyConsumption {
        energy: 123456789,
        resolution: MOCK_ENERGY_RESOLUTION,
        timestamp: MOCK_TIMESTAMP,
    },
    AmdEnergyConsumption {
        energy: 123456789 + 100,
        resolution: MOCK_ENERGY_RESOLUTION,
        timestamp: MOCK_TIMESTAMP + 100,
    },
];

pub const MOCK_POWER: AmdPowerInfo = AmdPowerInfo {
    socket_power: Some(43),
    current_socket_power: Some(45),
    average_socket_power: Some(47),
    gfx_voltage: 850,
    soc_voltage: 840,
    mem_voltage: 830,
    power_limit: 65535,
};

pub const MOCK_TEMPERATURE: &[(AmdTemperatureType, i64)] = &[
    (AmdTemperatureType::AMDSMI_TEMPERATURE_TYPE_EDGE, 45),
    (AmdTemperatureType::AMDSMI_TEMPERATURE_TYPE_HOTSPOT, 46),
    (AmdTemperatureType::AMDSMI_TEMPERATURE_TYPE_HBM_0, 47),
    (AmdTemperatureType::AMDSMI_TEMPERATURE_TYPE_HBM_1, 48),
    (AmdTemperatureType::AMDSMI_TEMPERATURE_TYPE_HBM_2, 49),
    (AmdTemperatureType::AMDSMI_TEMPERATURE_TYPE_HBM_3, 50),
    (AmdTemperatureType::AMDSMI_TEMPERATURE_TYPE_PLX, 51),
];

pub const MOCK_MEMORY: &[(AmdMemoryType, u64)] = &[
    (AmdMemoryType::AMDSMI_MEM_TYPE_VRAM, 131072),
    (AmdMemoryType::AMDSMI_MEM_TYPE_GTT, 262144),
];

pub fn mock_asic_info() -> AmdAsicInfo {
    AmdAsicInfo {
        market_name: "AMD Instinct MI210".to_owned(),
        vendor_id: 4098,
        vendor_name: "Advanced Micro Devices, Inc. [AMD/ATI]".to_owned(),
        subvendor_id: 4098,
        device_id: 29711,
        rev_id: 2,
        asic_serial: "80eae05c945bb3b2".to_owned(),
        oam_id: 1,
        num_of_compute_units: 104,
        target_graphics_version: 2314,
        subsystem_id: Some(3124),
    }
}

pub fn mock_process() -> AmdProcessInfo {
    AmdProcessInfo {
        name: MOCK_PROCESS_NAME.to_string(),
        pid: 1,
        mem: 131072,
        engine_usage: AmdProcessEngineUsage {
            gfx: 1234567,
            enc: 2345678,
        },
        memory_usage: AmdProcessMemoryUsage {
            gtt_mem: 1234567,
            cpu_mem: 2345678,
            vram_mem: 3456789,
        },
        container_name: MOCK_PROCESS_NAME.to_string(),
        cu_occupancy: Some(42),
        evicted_time: Some(65535),
    }
}
