// Path: src/main/java/com/jagrosh/giveawaybot/database/Database.java
// public class Database extends DatabaseConnector
// {
//     public final GiveawayManager giveaways;
//     public final GuildSettingsManager settings;
//     public final PremiumManager premium;
//     public final ExpandedGiveawayManager expanded;
//     
//     public Database (String host, String user, String pass) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException
//     {
//         super(host, user, pass);
//         
//         this.giveaways = new GiveawayManager(this);
//         this.settings = new GuildSettingsManager(this);
//         this.premium = new PremiumManager(this);
//         this.expanded = new ExpandedGiveawayManager(this);
//         
//         init();
//     }
//     
//     public boolean databaseCheck()
//     {
//         return this.giveaways.getGiveaways() != null;
//     }
// }
// 
// Path: src/main/java/com/jagrosh/giveawaybot/database/managers/PremiumManager.java
// public class Summary
// {
//     private final Map<Long,PremiumLevel> removed = new HashMap<>();
//     private final Map<Long,Pair<PremiumLevel,PremiumLevel>> changed = new HashMap<>();
//     private final Map<Long,PremiumLevel> added = new HashMap<>();
//         
//     public boolean isEmpty()
//     {
//         return removed.isEmpty() && changed.isEmpty() && added.isEmpty();
//     }
//         
//     @Override
//     public String toString()
//     {
//         StringBuilder sb = new StringBuilder("```diff");
//         added.forEach((u,l) -> sb.append("\n+ ").append(u).append(" ").append(l));
//         changed.forEach((u,p) -> sb.append("\n# ").append(u).append(" ").append(p.getLeft()).append(" -> ").append(p.getRight()));
//         removed.forEach((u,l) -> sb.append("\n- ").append(u).append(" ").append(l));
//         return sb.append("\n```").toString();
//     }
// }


import club.minnced.discord.webhook.WebhookClient;
import club.minnced.discord.webhook.WebhookClientBuilder;
import com.jagrosh.giveawaybot.database.Database;
import com.jagrosh.giveawaybot.database.managers.PremiumManager.Summary;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.util.EnumSet;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.requests.GatewayIntent;
import net.dv8tion.jda.api.utils.ChunkingFilter;
import net.dv8tion.jda.api.utils.MemberCachePolicy;
import net.dv8tion.jda.api.utils.cache.CacheFlag;
import org.slf4j.LoggerFactory;
/*
 * Copyright 2019 John Grosh (john.a.grosh@gmail.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.jagrosh.giveawaybot;


/**
 *
 * @author John Grosh (john.a.grosh@gmail.com)
 */
public class Checker
{
    /**
     * Runs the application as a premium updater
     * @throws Exception 
     */
    public static void main() throws Exception
    {
        LoggerFactory.getLogger("Checker").info("Checker starting.");
        
        Config config = ConfigFactory.load();
        long premiumServerId = config.getLong("checker-server");
        
        // connects to the database
// Path: src/main/java/com/jagrosh/giveawaybot/database/Database.java
// public class Database extends DatabaseConnector
// {
//     public final GiveawayManager giveaways;
//     public final GuildSettingsManager settings;
//     public final PremiumManager premium;
//     public final ExpandedGiveawayManager expanded;
//     
//     public Database (String host, String user, String pass) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException
//     {
//         super(host, user, pass);
//         
//         this.giveaways = new GiveawayManager(this);
//         this.settings = new GuildSettingsManager(this);
//         this.premium = new PremiumManager(this);
//         this.expanded = new ExpandedGiveawayManager(this);
//         
//         init();
//     }
//     
//     public boolean databaseCheck()
//     {
//         return this.giveaways.getGiveaways() != null;
//     }
// }
// 
// Path: src/main/java/com/jagrosh/giveawaybot/database/managers/PremiumManager.java
// public class Summary
// {
//     private final Map<Long,PremiumLevel> removed = new HashMap<>();
//     private final Map<Long,Pair<PremiumLevel,PremiumLevel>> changed = new HashMap<>();
//     private final Map<Long,PremiumLevel> added = new HashMap<>();
//         
//     public boolean isEmpty()
//     {
//         return removed.isEmpty() && changed.isEmpty() && added.isEmpty();
//     }
//         
//     @Override
//     public String toString()
//     {
//         StringBuilder sb = new StringBuilder("```diff");
//         added.forEach((u,l) -> sb.append("\n+ ").append(u).append(" ").append(l));
//         changed.forEach((u,p) -> sb.append("\n# ").append(u).append(" ").append(p.getLeft()).append(" -> ").append(p.getRight()));
//         removed.forEach((u,l) -> sb.append("\n- ").append(u).append(" ").append(l));
//         return sb.append("\n```").toString();
//     }
// }


// Path: src/main/java/com/jagrosh/giveawaybot/Checker.java
import club.minnced.discord.webhook.WebhookClient;
import club.minnced.discord.webhook.WebhookClientBuilder;
import com.jagrosh.giveawaybot.database.Database;
import com.jagrosh.giveawaybot.database.managers.PremiumManager.Summary;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import java.util.EnumSet;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.requests.GatewayIntent;
import net.dv8tion.jda.api.utils.ChunkingFilter;
import net.dv8tion.jda.api.utils.MemberCachePolicy;
import net.dv8tion.jda.api.utils.cache.CacheFlag;
import org.slf4j.LoggerFactory;

/*
 * Copyright 2019 John Grosh (john.a.grosh@gmail.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.jagrosh.giveawaybot;


/**
 *
 * @author John Grosh (john.a.grosh@gmail.com)
 */
public class Checker
{
    /**
     * Runs the application as a premium updater
     * @throws Exception 
     */
    public static void main() throws Exception
    {
        LoggerFactory.getLogger("Checker").info("Checker starting.");
        
        Config config = ConfigFactory.load();
        long premiumServerId = config.getLong("checker-server");
        
        // connects to the database
        Database database = new Database(config.getString("database.host"), 