#pragma once

#include <mmdeviceapi.h>
#include <endpointvolume.h>
#include <string>
#include <vector>
#include "AudioNotificationListener.h"

class AudioDevice {
public:
	IMMDevice* device = nullptr;
	IAudioEndpointVolume* volumeInterface = nullptr;
	IAudioMeterInformation* meterInterface = nullptr;
	std::wstring id = {};
	std::string name = {};
	unsigned long state = {};
	bool isDefaultConsole = {};
	bool isDefaultMedia = {};
	bool isDefaultCommunication = {};

	AudioDevice(IMMDevice* device, LPCWSTR deviceId);
	AudioDevice(AudioDevice&& other) noexcept;
	AudioDevice& operator=(AudioDevice&& other) noexcept;
	~AudioDevice();
};

class AudioData {
public:
	std::vector<AudioDevice> playbackDevices = {};
	std::vector<AudioDevice> recordingDevices = {};
	IMMDeviceEnumerator* deviceEnumerator = nullptr;
	AudioNotificationListener* audioNotificationListener = nullptr;

	AudioData();
	AudioData(AudioData&& other) noexcept;
	AudioData& operator=(AudioData&& other) noexcept;
	~AudioData();
};

class ApplicationSettings {
public:
	bool autostart = false;
	bool docked = false;
	bool showDisabledDevices = false;
};

class ApplicationData {
public:
	ApplicationSettings settings = {};
	std::shared_ptr<AudioData> audioData = std::make_shared<AudioData>();

	ApplicationData(const ApplicationData&) = delete;
	ApplicationData& operator=(const ApplicationData&) = delete;
};
