/**
 * @typedef {Object} LootTableEntry
 * @property {string} itemId - ID of the item
 * @property {number} weight - Probability weight
 * @property {number} [minLevel] - Minimum level required
 */

/**
 * @typedef {Object} CampaignMissionNode
 * @property {string} id - Unique ID of the mission reference
 * @property {string} missionId - ID of the mission template to use
 * @property {string} title - Display title for this step
 * @property {string[]} [next] - IDs of potential next missions (for branching)
 * @property {Object} [requirements] - Requirements to unlock
 */

/**
 * @typedef {Object} Campaign
 * @property {string} id - Unique Campaign ID
 * @property {string} title - Display Title
 * @property {string} description - Brief description
 * @property {string} author - Author name
 * @property {string} version - Version string (e.g. "1.0.0")
 * @property {CampaignMissionNode[]} missions - Graph of missions
 * @property {Object.<string, LootTableEntry[]>} lootTables - Global loot tables
 */

export const CampaignSchema = {
    type: "object",
    required: ["id", "title", "missions"],
    properties: {
        id: { type: "string" },
        title: { type: "string" },
        description: { type: "string" },
        author: { type: "string" },
        version: { type: "string" },
        missions: {
            type: "array",
            items: {
                type: "object",
                required: ["id", "missionId"],
                properties: {
                    id: { type: "string" },
                    missionId: { type: "string" },
                    title: { type: "string" },
                    next: { type: "array", items: { type: "string" } }
                }
            }
        }
    }
};
