"""Demo data for yaml-doctor — realistic sample YAML files with known issues."""

from __future__ import annotations

DEMO_KUBERNETES = """apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: web-app
  template:
    metadata:
      labels:
        app: web-app
    spec:
      containers:
        - name: web
          image: nginx:latest
          securityContext:
            runAsRoot: true
            privileged: true
            allowPrivilegeEscalation: true
          ports:
            - containerPort: 80
          env:
            - name: DB_PASSWORD
              value: "supersecret123"
"""

DEMO_COMPOSE = """version: "3"
services:
  web:
    image: myapp:latest
    privileged: true
    ports:
      - "0.0.0.0:8080:80"
    environment:
      - AWS_SECRET_KEY=AKIAIOSFODNN7EXAMPLE
      - DATABASE_URL=postgres://admin:password@db:5432/mydb
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  db:
    image: postgres:latest
    network_mode: host
    environment:
      POSTGRES_PASSWORD: password123
"""

DEMO_GITHUB_ACTIONS = """name: CI
on:
  pull_request_target:
    branches: [main]

permissions: write-all

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@main
        with:
          persist-credentials: true

      - name: Run tests
        run: |
          echo "Testing ${{ github.event.pull_request.body }}"
          npm test

      - uses: some-action/deploy@v1
        env:
          SECRET_KEY: ${{ secrets.DEPLOY_KEY }}
"""

DEMO_GITLAB_CI = """image: python:latest

stages:
  - test
  - deploy

test:
  stage: test
  script:
    - pip install -r requirements.txt
    - export API_KEY="sk-abc123secretkey"
    - pytest
  allow_failure: true

deploy:
  stage: deploy
  script:
    - echo "deploying..."
  only:
    - main
"""

DEMO_YAML_BAD = """# Badly formatted YAML example
name: test-config   
database:
  host: localhost
  port: 5432
  password: MyS3cretP@ss!
  connection_string: "postgresql://admin:password123@localhost:5432/db"
  api_key: AKIA1234567890ABCDEF

items:
  - one
  -  two
  -   three
"""

DEMOS = {
    "kubernetes": ("deployment.yaml", DEMO_KUBERNETES),
    "compose": ("docker-compose.yml", DEMO_COMPOSE),
    "github-actions": (".github/workflows/ci.yml", DEMO_GITHUB_ACTIONS),
    "gitlab-ci": (".gitlab-ci.yml", DEMO_GITLAB_CI),
    "yaml": ("config.yaml", DEMO_YAML_BAD),
}
