namespace OrderPROPrint.Forms;

partial class SettingsForm
{
    private System.ComponentModel.IContainer components = null;
    private TextBox txtApiUrl;
    private TextBox txtApiKey;
    private ComboBox cmbPrinter;
    private NumericUpDown nudPollInterval;
    private Button btnTestConnection;
    private Button btnSave;
    private Button btnCancel;
    private Label lblStatus;

    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    private void InitializeComponent()
    {
        this.Text = "OrderPRO Print — Ustawienia";
        this.Size = new Size(450, 340);
        this.FormBorderStyle = FormBorderStyle.FixedDialog;
        this.MaximizeBox = false;
        this.MinimizeBox = false;
        this.StartPosition = FormStartPosition.CenterScreen;

        var lblApiUrl = new Label { Text = "URL API:", Location = new Point(15, 20), AutoSize = true };
        txtApiUrl = new TextBox { Location = new Point(15, 40), Size = new Size(400, 23) };
        txtApiUrl.PlaceholderText = "https://orderpro.projectpro.pl";

        var lblApiKey = new Label { Text = "Klucz API:", Location = new Point(15, 75), AutoSize = true };
        txtApiKey = new TextBox { Location = new Point(15, 95), Size = new Size(310, 23), UseSystemPasswordChar = true };

        btnTestConnection = new Button { Text = "Testuj", Location = new Point(335, 94), Size = new Size(80, 25) };
        btnTestConnection.Click += BtnTestConnection_Click;

        lblStatus = new Label { Location = new Point(15, 123), Size = new Size(400, 18), ForeColor = Color.Gray, Text = "" };

        var lblPrinter = new Label { Text = "Drukarka:", Location = new Point(15, 150), AutoSize = true };
        cmbPrinter = new ComboBox { Location = new Point(15, 170), Size = new Size(400, 23), DropDownStyle = ComboBoxStyle.DropDownList };

        var lblInterval = new Label { Text = "Interwał odpytywania (sekundy):", Location = new Point(15, 205), AutoSize = true };
        nudPollInterval = new NumericUpDown { Location = new Point(15, 225), Size = new Size(80, 23), Minimum = 5, Maximum = 300, Value = 10 };

        btnSave = new Button { Text = "Zapisz", Location = new Point(230, 265), Size = new Size(90, 30) };
        btnSave.Click += BtnSave_Click;

        btnCancel = new Button { Text = "Anuluj", Location = new Point(325, 265), Size = new Size(90, 30) };
        btnCancel.Click += BtnCancel_Click;

        this.Controls.AddRange(new Control[] {
            lblApiUrl, txtApiUrl,
            lblApiKey, txtApiKey, btnTestConnection,
            lblStatus,
            lblPrinter, cmbPrinter,
            lblInterval, nudPollInterval,
            btnSave, btnCancel
        });

        this.AcceptButton = btnSave;
        this.CancelButton = btnCancel;
    }
}
