import 'dotenv/config';
import {Client, GatewayIntentBits} from "discord.js";
import {MessageSender} from "./base/MessageSender.js";
import {InstagramTokenManager} from "./instagram/instagramTokenManager.js";
import {InstagramPoller} from "./instagram/instagramPoller.js";
import {UsersToken} from "./usersToken.js";

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildMembers,
    ]
});

const nameCardTemplate = "./wwwroot/assets/name-card-template.png";
const sender = new MessageSender(client);

const instagramID = process.env.INSTAGRAM_CLIENT_ID;
const instagramSecret = process.env.INSTAGRAM_CLIENT_SECRET;

const updateChannelID = process.env.BOT_UPDATE_CHANNEL_ID;
const socialChannelID = process.env.SOCIAL_CHANNEL_ID
const welcomeChannelID = process.env.WELCOME_CHANNEL_ID

const filePath = ".instagram_client_tokens.json";

const usersToken = new UsersToken(filePath)

const instagramTokenManager = new InstagramTokenManager(
    {clientID : instagramID, clientSecret : instagramSecret, usersToken : usersToken}
);

const instagramPoller = new InstagramPoller(process.env.INSTAGRAM_POST_LIST, process.env.INSTAGRAM_POST_DETAILS, instagramTokenManager);

export const data = {
    client,
    sender,
    instagramPoller,
    updateChannelID,
    socialChannelID,
    welcomeChannelID,
    instagramTokenManager,
    nameCardTemplate
    //tiktokTokenManager
};

/*
const tiktokTokenManager = new TikTokTokenManager(
    {filepath : ".tiktok_client_tokens.json", clientKey : "", clientSecret : ""}
);
 */