package handler

import (
	"fmt"
	"net/http"
	"strings"
)

// GetIncident responds to the link generated in the response to a New Snow
func (h *Handler) GetIncident(w http.ResponseWriter, r *http.Request) {

	// TODO

	path := r.URL.Path
	// Expected format: /api/now/table/incident/{id}
	parts := strings.Split(path, "/")

	if len(parts) != 6 || parts[1] != "api" || parts[2] != "now" || parts[3] != "table" || parts[4] != "incident" {
		http.NotFound(w, r)
		return
	}

	id := parts[5] // Extract {id}
	fmt.Fprintf(w, "Incident ID: %s", id)
}
