/**
 * Inventory-Based Pose Bank
 * Poses organized by item type and intensity
 */

const inventoryPoseBank = {
    // Basic poses (no items required)
    basic: [
        {
            name: "Standing Neutral",
            instruction: "Stand naturally with hands at sides",
            description: "Basic standing position for documentation"
        },
        {
            name: "Kneeling Submission",
            instruction: "Kneel with hands on thighs, head slightly bowed",
            description: "Submissive kneeling position"
        },
        {
            name: "Sitting Display",
            instruction: "Sit with legs together, hands in lap",
            description: "Modest sitting position"
        }
    ],

    // Panty-specific poses
    panty: [
        {
            name: "Panty Display",
            instruction: "Standing, pull waistband to show panties clearly",
            description: "Display your panties for the camera"
        },
        {
            name: "Panty Peek",
            instruction: "Bent over, looking back at camera to show panties",
            description: "Bend to reveal your panties"
        },
        {
            name: "Panties Down",
            instruction: "Pull panties down to mid-thigh, exposed",
            description: "Lower your panties to expose yourself"
        },
        {
            name: "Panty Adjustment",
            instruction: "Hands adjusting panties, showing waistband",
            description: "Adjust your panties for the camera"
        }
    ],

    // Bra-specific poses
    bra: [
        {
            name: "Bra Display",
            instruction: "Arms behind back, chest forward to display bra",
            description: "Show off your bra"
        },
        {
            name: "Bra Adjustment",
            instruction: "Hands adjusting bra straps or cups",
            description: "Adjust your bra for proper fit"
        },
        {
            name: "Strap Show",
            instruction: "Pull strap to show bra clearly",
            description: "Display your bra strap"
        }
    ],

    // Dress/Skirt poses
    dress: [
        {
            name: "Twirl Display",
            instruction: "Spin in circle, dress/skirt fanning out",
            description: "Twirl to show off your outfit"
        },
        {
            name: "Dress Lift",
            instruction: "Lift hem to show what's underneath",
            description: "Lift your dress to reveal beneath"
        },
        {
            name: "Sitting Ladylike",
            instruction: "Sit with legs crossed, smoothing dress",
            description: "Sit properly in your feminine outfit"
        },
        {
            name: "Curtsy",
            instruction: "Hold dress edges, cross leg behind, bow head",
            description: "Perform a proper feminine curtsy"
        },
        {
            name: "Dress Adjust",
            instruction: "Standing, adjust dress while posing",
            description: "Adjust your dress demurely"
        }
    ],

    // Heel-specific poses
    heel: [
        {
            name: "Heel Display Standing",
            instruction: "Standing with one foot forward to show heels",
            description: "Display your heels while standing"
        },
        {
            name: "Walking Pose",
            instruction: "Mid-step pose showing heel and posture",
            description: "Pose as if walking in heels"
        },
        {
            name: "Kneeling in Heels",
            instruction: "Kneel while keeping heels on",
            description: "Kneel without removing your heels"
        },
        {
            name: "Bent Over in Heels",
            instruction: "Bend at waist while wearing heels",
            description: "Bend over while in heels"
        }
    ],

    // Toy poses
    toy: [
        {
            name: "Dildo to Mouth",
            instruction: "Hold dildo near or touching mouth",
            description: "Display toy near your mouth"
        },
        {
            name: "Plug Display",
            instruction: "Bent over to show inserted plug",
            description: "Reveal your inserted plug"
        },
        {
            name: "Chastity Show",
            instruction: "Standing or sitting, display locked cage/belt",
            description: "Show your chastity device"
        },
        {
            name: "Restrained Position",
            instruction: "Pose with wrists/ankles in restraints",
            description: "Display yourself in restraints"
        },
        {
            name: "Gagged Display",
            instruction: "Head up, show gag clearly",
            description: "Display your gag"
        },
        {
            name: "Clamped Nipples",
            instruction: "Chest forward to display nipple clamps",
            description: "Show your clamped nipples"
        },
        {
            name: "Toy Insertion Pose",
            instruction: "Positioned to show toy insertion",
            description: "Pose showing toy being used"
        }
    ],

    // Edging poses
    edging: [
        {
            name: "Standing Edge",
            instruction: "Standing while edging yourself",
            description: "Edge while standing upright"
        },
        {
            name: "Kneeling Edge",
            instruction: "Kneeling while edging, maintain posture",
            description: "Edge while in kneeling position"
        },
        {
            name: "Bent Over Edge",
            instruction: "Bent over while edging yourself",
            description: "Edge while bent at the waist"
        },
        {
            name: "Spread Eagle Edge",
            instruction: "Lying back, legs spread, edging",
            description: "Edge while fully spread"
        },
        {
            name: "Squatting Edge",
            instruction: "Deep squat while edging, legs wide",
            description: "Edge in degrading squat position"
        },
        {
            name: "Mirror Edge",
            instruction: "Edge while watching yourself in mirror",
            description: "Edge while seeing your reflection"
        },
        {
            name: "Thigh Squeeze Edge",
            instruction: "Sitting or lying, squeeze thighs to edge",
            description: "Edge by squeezing thighs together"
        },
        {
            name: "On Back Edge",
            instruction: "Lying on back with legs spread, edge yourself",
            description: "Edge while on your back"
        },
        {
            name: "Dressed Edge",
            instruction: "Edge while fully dressed in feminine outfit",
            description: "Edge while wearing your outfit"
        },
        {
            name: "Exposed Edge",
            instruction: "Standing against wall, spread, edge while exposed",
            description: "Edge while fully exposed"
        }
    ]
};

/**
 * Select pose based on category
 */
function selectPoseForCategory(category, usedPoses = new Set()) {
    const poses = inventoryPoseBank[category] || inventoryPoseBank.basic;
    
    // Filter out used poses
    const availablePoses = poses.filter(pose => !usedPoses.has(pose.name));
    
    // If all poses used, reset
    if (availablePoses.length === 0) {
        console.log(`🔄 All ${category} poses used - resetting`);
        return selectPoseForCategory(category, new Set());
    }
    
    // Select random pose
    const randomIndex = Math.floor(Math.random() * availablePoses.length);
    const selectedPose = availablePoses[randomIndex];
    
    console.log(`📸 Selected ${category} pose: ${selectedPose.name}`);
    
    return selectedPose;
}

/**
 * Get all poses for a category
 */
function getPosesByCategory(category) {
    return inventoryPoseBank[category] || inventoryPoseBank.basic;
}

// Make available globally
window.inventoryPoseBank = inventoryPoseBank;
window.selectPoseForCategory = selectPoseForCategory;
window.getPosesByCategory = getPosesByCategory;
