# Scénario: Liste des tags
name: tags_list
version: "1.0"
description: Retourne tous les tags de l'utilisateur avec compteurs

steps:
  - id: get_tags
    service: db
    action: query
    params:
      query: |
        SELECT t.*,
               (SELECT COUNT(*) FROM project_tags pt WHERE pt.tag_id = t.id) as project_count,
               (SELECT COUNT(*) FROM task_tags tt WHERE tt.tag_id = t.id) as task_count
        FROM tags t
        WHERE t.user_id = ?
        ORDER BY t.name ASC
      args: ["{{auth.user_id}}"]

output:
  status: 200
  body:
    success: true
    data: "{{steps.get_tags.result}}"
