using System.Globalization;
using GmRelay.Shared.Platform;

namespace GmRelay.Bot.Infrastructure.Telegram;

internal static class TelegramPlatformIds
{
    public static PlatformGroup Group(long chatId, int? threadId = null, string? displayName = null) =>
        new(
            PlatformKind.Telegram,
            chatId.ToString(CultureInfo.InvariantCulture),
            displayName ?? "Telegram chat",
            ExternalChannelId: chatId.ToString(CultureInfo.InvariantCulture),
            ExternalThreadId: threadId?.ToString(CultureInfo.InvariantCulture));

    public static PlatformUser User(long telegramId, string displayName, string? username = null) =>
        new(
            PlatformKind.Telegram,
            telegramId.ToString(CultureInfo.InvariantCulture),
            displayName,
            username);

    public static PlatformMessageRef Message(long chatId, int? threadId, int messageId) =>
        new(
            PlatformKind.Telegram,
            chatId.ToString(CultureInfo.InvariantCulture),
            threadId?.ToString(CultureInfo.InvariantCulture),
            messageId.ToString(CultureInfo.InvariantCulture));
}
