import { SectionData } from './types';

export const GUIDE_CONTENT: SectionData[] = [
  {
    id: "intro",
    title: "1. What is Git?",
    blocks: [
      {
        type: 'paragraph',
        content: "Git is a version control system. Imagine you're working on a game design document, and you want to try out a new idea for a level, but you're not sure if it'll work. With git, you can save your current version, try the new idea, and if it doesn't work out, you can go back to exactly where you were before. No \"final_FINAL_v3_actually_final.txt\" nonsense."
      },
      {
        type: 'paragraph',
        content: "Git tracks changes to files over time, creating a history of your project. Every time you \"save\" (which we call a commit), git takes a snapshot of your entire project. You can view any of these snapshots at any time, compare them, or even combine changes from different versions."
      }
    ]
  },
  {
    id: "setup",
    title: "2. Initial Setup",
    blocks: [
      {
        type: 'paragraph',
        content: "First, let's configure git with your information. Open your terminal and run these commands:"
      },
      {
        type: 'code',
        language: 'bash',
        content: `# Set your name (this will appear in your commits)
git config --global user.name "Sylvi"

# Set your email (use the email you registered with Gitea)
git config --global user.email "your-email@example.com"

# Set your default text editor (optional, but helpful)
git config --global core.editor "nano"

# Check your configuration
git config --list`
      },
      {
        type: 'callout',
        variant: 'tip',
        content: "Every change you make in git is tagged with your name and email. This helps everyone (including future you) know who made which changes and when."
      }
    ]
  },
  {
    id: "file-types",
    title: "3. Understanding Files",
    blocks: [
      {
        type: 'paragraph',
        content: "When working with git, you'll encounter a few special files and formats. Let's break them down:"
      },
      {
        type: 'subheading',
        content: ".git Directory"
      },
      {
        type: 'paragraph',
        content: "This hidden folder is where git stores all its magic. It contains the entire history of your project. You'll never need to edit files in here directly—git handles it all."
      },
      {
        type: 'subheading',
        content: ".gitignore File"
      },
      {
        type: 'paragraph',
        content: "This file tells git which files or folders to ignore. It's super useful for keeping temporary files, build artifacts, or sensitive data out of your repository."
      },
      {
        type: 'code',
        language: 'plaintext',
        content: `# Example .gitignore file
*.log
node_modules/
.DS_Store
Thumbs.db
config/secrets.json`
      },
      {
        type: 'collapsible',
        content: {
            title: "📄 Common File Formats You'll Work With",
            body: [
                {
                    type: 'list',
                    content: [
                        ".md - Markdown files (like README.md) for documentation",
                        ".html, .css, .js - Web development files",
                        ".json - Configuration and data files",
                        ".yml/.yaml - Configuration files",
                        "Binary Files: Images, compiled code, etc."
                    ]
                }
            ]
        }
      }
    ]
  },
  {
    id: "creating-repo",
    title: "4. Creating Your First Repo",
    blocks: [
      {
        type: 'paragraph',
        content: "There are two ways to start with git: create a new repository from scratch, or clone an existing one."
      },
      {
        type: 'subheading',
        content: "Method 1: Local Repository"
      },
      {
        type: 'code',
        language: 'bash',
        content: `# Create a new directory for your project
mkdir my-awesome-project
cd my-awesome-project

# Initialize a git repository
git init

# Check the status (you should see "No commits yet")
git status`
      },
      {
        type: 'subheading',
        content: "Method 2: Create on Gitea First"
      },
      {
        type: 'ordered-list',
        content: [
            "Log into your Gitea account",
            "Click the '+' icon or 'New Repository' button",
            "Give it a name and description",
            "Click 'Create Repository'"
        ]
      },
      {
        type: 'collapsible',
        variant: 'success',
        content: {
            title: "✏️ Practice Exercise #1",
            body: [
                { type: 'paragraph', content: "Create a new directory called 'git-practice' and initialize it as a git repository. Then check its status." },
                { type: 'subheading', content: "Solution:" },
                { type: 'code', language: 'bash', content: "mkdir git-practice\ncd git-practice\ngit init\ngit status" }
            ]
        }
      }
    ]
  },
  {
    id: "basic-workflow",
    title: "5. The Basic Workflow",
    blocks: [
        {
            type: 'paragraph',
            content: "The core git workflow has three main stages: Working Directory (your files), Staging Area (files marked for commit), and Repository (saved history)."
        },
        {
            type: 'diagram',
            content: 'workflow'
        },
        { type: 'subheading', content: "Step 1: Make Changes" },
        { type: 'code', language: 'bash', content: `echo "# My Awesome Project" > README.md\ngit status` },
        
        { type: 'subheading', content: "Step 2: Stage Changes" },
        { type: 'paragraph', content: "Tell git which changes you want to include in the next commit." },
        { type: 'code', language: 'bash', content: `git add README.md\n# Or stage all\ngit add .` },

        { type: 'subheading', content: "Step 3: Commit Changes" },
        { type: 'paragraph', content: "Create a snapshot of your staged changes." },
        { type: 'code', language: 'bash', content: `git commit -m "Add README file"` },

        { type: 'callout', variant: 'info', content: "Tip: Write clear commit messages! 'Add player movement controls' is better than 'stuff'." },

        { type: 'subheading', content: "Step 4: Push to Remote" },
        { type: 'code', language: 'bash', content: `git push origin main` },
        { type: 'callout', variant: 'warning', content: "First push? You might need: git push -u origin main" }
    ]
  },
  {
    id: "cloning",
    title: "6. Cloning Repositories",
    blocks: [
        { type: 'paragraph', content: "Cloning is how you download a copy of an existing repository from Gitea to your computer." },
        { type: 'code', language: 'bash', content: `git clone https://your-gitea-instance.com/username/repo-name.git` },
        { type: 'callout', variant: 'info', content: "HTTPS is simpler (username/password). SSH is more secure but requires key setup." }
    ]
  },
  {
    id: "branching",
    title: "7. Branching & Merging",
    blocks: [
        { type: 'paragraph', content: "Branches are like parallel universes for your project. You can try things out without affecting the main code." },
        { type: 'code', language: 'bash', content: `# Create and switch to new branch
git checkout -b new-feature

# Make changes...

# Switch back to main
git checkout main

# Merge the new feature
git merge new-feature

# Delete the old branch
git branch -d new-feature` },
        { type: 'callout', variant: 'warning', content: "Merge Conflicts happen when git can't automatically combine changes. Don't panic! Open the file, look for <<<<<<< HEAD, fix it, and commit." }
    ]
  },
  {
    id: "common-pitfalls",
    title: "8. Common Pitfalls",
    blocks: [
        { type: 'collapsible', content: { title: "Mistake #1: Committed to Wrong Branch", body: [
            { type: 'paragraph', content: "If you haven't pushed yet:" },
            { type: 'code', language: 'bash', content: `git branch correct-branch\ngit reset --hard HEAD~1\ngit checkout correct-branch` }
        ]} },
        { type: 'collapsible', content: { title: "Mistake #2: Undo Last Commit", body: [
            { type: 'paragraph', content: "Undo commit but keep changes:" },
            { type: 'code', language: 'bash', content: `git reset --soft HEAD~1` }
        ]} },
        { type: 'collapsible', content: { title: "Mistake #3: Pushed Sensitive Data", body: [
            { type: 'callout', variant: 'warning', content: "If you push passwords/keys, consider them compromised. Change the passwords immediately." }
        ]} }
    ]
  },
  {
    id: "cheat-sheet",
    title: "9. Cheat Sheet",
    blocks: [
        { type: 'paragraph', content: "Quick reference for your daily workflow." },
        { type: 'code', language: 'bash', content: `git status         # Check status
git add .          # Stage all
git commit -m "m"  # Commit
git push           # Upload
git pull           # Download
git log --oneline  # History` }
    ]
  }
];
