# Scénario: Supprimer un projet
name: projects_delete
version: "1.0"
description: Supprime un projet (cascade sur sous-projets et tâches)

input:
  required:
    - id
  validation:
    id:
      type: int

steps:
  - id: check_project
    service: db
    action: query_one
    params:
      query: "SELECT id FROM projects WHERE id = ? AND user_id = ?"
      args: ["{{input.id}}", "{{auth.user_id}}"]
    on_error: abort
    error_message: "Projet non trouvé"
    error_status: 404

  - id: delete_project
    service: db
    action: delete
    params:
      table: projects
      where:
        id: "{{input.id}}"

output:
  status: 200
  body:
    success: true
    message: "Projet supprimé"
