1: <?php
2:
3: namespace LaravelUi5\Core\Ui5\Contracts;
4:
5: /**
6: * Contract for all UI5 entities that can be addressed via a URL segment (slug).
7: *
8: * A slug is a short, URL-safe identifier used to generate client routes and
9: * bind server-side endpoints. It is unique within the context of its parent,
10: * typically a module, and forms part of the full `url_key` (e.g. "card/core/budget").
11: *
12: * All sluggable artifacts must implement this interface to be routable from
13: * the UI or resolvable in policies, manifests, or database records.
14: *
15: * Examples:
16: * - "app/hello" → slug = "hello"
17: * - "card/budget" → slug = "budget"
18: * - "api/user/toggle-lock" → slug = "toggle-lock"
19: *
20: * The slug should be URL-friendly (lowercase, kebab-case) and stable.
21: */
22: interface SluggableInterface
23: {
24: /**
25: * Returns the slug that identifies this artifact/module/action within its context.
26: *
27: * This value is used to generate the `url_key`, which serves as a unified
28: * identifier across the client (routing), server (controllers), registry,
29: * and admin/database layers.
30: *
31: * @return string A stable, kebab-case string (e.g. "toggle-lock", "budget-report")
32: */
33: public function getSlug(): string;
34: }
35: