#!/bin/bash
# MA_Structure_Script.sh
# Purpose: Initialize the Wave Bee Master Archive structure on Kali Linux.
# Version: 1.0.0 (2026-04-05)

set -e

# --- Configuration ---
ROOT_DIR="MasterArchive"
BASE_PATH="${1:-.}"
MA_ROOT="${BASE_PATH}/${ROOT_DIR}"

# --- Color Scheme for Kali ---
GREEN='\033[0;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
RESET='\033[0m'

echo -e "${CYAN}--- Initializing Master Archive ---${RESET}"

# Create Directory Hierarchy
DIRS=(
    "01_Legal_Compliance/Incorporation"
    "01_Legal_Compliance/Privacy_CCPA_CalOPPA"
    "01_Legal_Compliance/IP_Trademarks"
    "02_Finance/Bank_Records"
    "02_Finance/Tax_Exempt_Certificates"
    "02_Finance/Invoices_Receipts"
    "03_Operations/SOPs_Internal"
    "03_Operations/Logistics"
    "03_Operations/Suppliers"
    "04_Production/Designs_Source"
    "04_Production/Tech_Packs"
    "04_Production/Quality_Control"
    "05_Marketing_Media/Branding_Asssets"
    "05_Marketing_Media/Social_Reels"
    "05_Marketing_Media/Ad_Campaigns"
    "06_Architecture_Dev/Web_Assets"
    "06_Architecture_Dev/Server_Configs"
    "07_Archive/Historical_Backups"
    "07_Archive/Deprecated_V1"
)

for dir in "${DIRS[@]}"; do
    mkdir -p "${MA_ROOT}/${dir}"
    echo -e "${GREEN}[OK]${RESET} Created: ${dir}"
done

# Create Placeholder READMEs
cat <<EOF > "${MA_ROOT}/README.md"
# Wave Bee Master Archive
**Official Single Source of Truth for Bnxo Apex Empire.**

## Directory Structure
- 01_Legal: CCPA, CalOPPA, Tax IDs.
- 02_Finance: Bank records and tax-exempt status.
- 03_Operations: Internal SOPs and Supplier lists.
- 04_Production: Design files and tech packs.
- 05_Marketing: Reels, Metadata, and Branding.
- 06_Dev: Cloudflare Pages, Web Assets, and Server code.
- 07_Archive: Versioned history.

*Generated on $(date)*
EOF

echo -e "${YELLOW}--- Initialization Complete at ${MA_ROOT} ---${RESET}"
chmod +x "$0"
