/*
* This file is part of Player Analytics (Plan).
*
* Plan is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License v3 as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Plan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Plan. If not, see .
*/
package com.djrapitops.plan.extension.implementation.storage.queries;
import com.djrapitops.plan.extension.ElementOrder;
import com.djrapitops.plan.extension.FormatType;
import com.djrapitops.plan.extension.icon.Color;
import com.djrapitops.plan.extension.icon.Family;
import com.djrapitops.plan.extension.icon.Icon;
import com.djrapitops.plan.extension.implementation.TabInformation;
import com.djrapitops.plan.extension.implementation.results.*;
import com.djrapitops.plan.storage.database.SQLDB;
import com.djrapitops.plan.storage.database.queries.Query;
import com.djrapitops.plan.storage.database.queries.QueryStatement;
import com.djrapitops.plan.storage.database.sql.tables.ExtensionIconTable;
import com.djrapitops.plan.storage.database.sql.tables.ExtensionPlayerValueTable;
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
import com.djrapitops.plan.storage.database.sql.tables.ExtensionTabTable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import static com.djrapitops.plan.storage.database.sql.parsing.Sql.*;
/**
* Query all ExtensionData by Server UUIDs.
*
* Returns Map: Server UUID - List of ExtensionData.
*
* How it is done:
* - Two queries are run, one that fetches all extensions and one that fetches all data of the player.
* - Data query is sorted into a multi-map: PluginID - Tab Name - Tab Data
* - (Tab Name can be empty.)
* - Multi-map is sorted into ExtensionData objects by PluginID, one per ID
* - This map is sorted into final Map: Server UUID - List of ExtensionData at the highest level.
*
* There are multiple data extraction methods to make extracting the value query easier.
*
* @author Rsl1122
*/
public class ExtensionPlayerDataQuery implements Query