using MySqlConnector;

namespace ChessCubing.Server.Data;

public sealed class SiteDataOptions
{
    public string Host { get; set; } = "mysql";

    public int Port { get; set; } = 3306;

    public string Database { get; set; } = "chesscubing_site";

    public string Username { get; set; } = "chesscubing";

    public string Password { get; set; } = "chesscubing";

    public int InitializationRetries { get; set; } = 12;

    public int InitializationDelaySeconds { get; set; } = 3;

    public string BuildConnectionString()
        => new MySqlConnectionStringBuilder
        {
            Server = Host,
            Port = checked((uint)Port),
            Database = Database,
            UserID = Username,
            Password = Password,
            CharacterSet = "utf8mb4",
            Pooling = true,
            ConnectionTimeout = 15,
        }.ConnectionString;
}
