using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.IO;

class Program
{
    static void Main()
    {
        // Create assets directory if not exists
        if (!Directory.Exists("assets"))
        {
            Directory.CreateDirectory("assets");
        }

        // Icon sizes
        int[] sizes = { 72, 96, 128, 144, 152, 192, 384, 512 };

        foreach (int size in sizes)
        {
            // Create bitmap
            using (Bitmap bitmap = new Bitmap(size, size))
            using (Graphics graphics = Graphics.FromImage(bitmap))
            {
                // Set high quality
                graphics.SmoothingMode = SmoothingMode.AntiAlias;
                graphics.TextRenderingHint = TextRenderingHint.AntiAlias;

                // Fill background with gradient
                using (LinearGradientBrush brush = new LinearGradientBrush(
                    new Rectangle(0, 0, size, size),
                    ColorTranslator.FromHtml("#1162d4"),
                    ColorTranslator.FromHtml("#0d4fa8"),
                    LinearGradientMode.ForwardDiagonal))
                {
                    graphics.FillRectangle(brush, 0, 0, size, size);
                }

                // Add QR text
                using (Font font = new Font("Arial", size * 0.4f, FontStyle.Bold))
                {
                    SizeF textSize = graphics.MeasureString("QR", font);
                    PointF textPosition = new PointF(
                        (size - textSize.Width) / 2,
                        (size - textSize.Height) / 2
                    );

                    graphics.DrawString("QR", font, Brushes.White, textPosition);
                }

                // Save icon
                bitmap.Save($"assets/icon-{size}x{size}.png", System.Drawing.Imaging.ImageFormat.Png);
                Console.WriteLine($"Created icon-{size}x{size}.png");
            }
        }

        Console.WriteLine("All icons created successfully!");
    }
}
