using QtCNETAPI.Services.ApiService;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace qtc_net_client_2.Forms
{
    public partial class CreateRoom : Form
    {
        private IApiService _apiService;
        public CreateRoom(IApiService apiService)
        {
            _apiService = apiService;
            InitializeComponent();
        }

        private async void btnCreate_Click(object sender, EventArgs e)
        {
            if(!string.IsNullOrEmpty(txtRoomName.Text))
            {
                await _apiService.CreateRoomAsync(new QtCNETAPI.Dtos.Room.RoomDto
                {
                    Name = txtRoomName.Text,
                    CreatedAt = DateTime.UtcNow,
                });
                DialogResult = DialogResult.OK;
                Close();
            }
        }
    }
}
