# Hiring domain (schema)

The **hiring** module is gated behind `hr`, `grants`, and `approvals` per `config/modules.php`. Schema is introduced in migrations such as `2026_04_28_100001_create_hiring_domain_tables.php`. Controllers and UI may evolve; this page documents the **data model** as migrated.

## Entity relationship (hiring tables)

```mermaid
erDiagram
  ORGANIZATIONS ||--o{ HIRING_REJECTION_REASON_CODES : defines
  ORGANIZATIONS ||--o{ HIRING_REQUISITIONS : owns
  GRANTS ||--o{ HIRING_REQUISITIONS : optional_funds
  USERS ||--o{ HIRING_REQUISITIONS : created_by

  HIRING_REQUISITIONS ||--o{ HIRING_POSTINGS : publishes
  HIRING_POSTINGS ||--o{ HIRING_APPLICATIONS : receives
  HIRING_CANDIDATES ||--o{ HIRING_APPLICATIONS : submits
  ORGANIZATIONS ||--o{ HIRING_CANDIDATES : scopes

  HIRING_APPLICATIONS ||--o{ HIRING_INTERVIEWS : schedules
  HIRING_INTERVIEWS ||--o{ HIRING_INTERVIEW_SCORES : scored_by
  HIRING_INTERVIEWS ||--o{ HIRING_INTERVIEW_MINUTES : records

  HIRING_APPLICATIONS ||--|| HIRING_EVALUATIONS : one_to_one
  HIRING_APPLICATIONS ||--o| HIRING_OFFERS : may_have
  HIRING_APPLICATIONS ||--o{ HIRING_CONTRACTS : legal
  HIRING_APPLICATIONS ||--o{ HIRING_ONBOARDING_TASKS : tasks

  HIRING_REQUISITIONS {
    uuid uuid UK
    string stage_code
    string title
    bigint grant_id FK_null
    bigint approval_instance_id FK_null
  }
  HIRING_POSTINGS {
    uuid uuid UK
    bigint requisition_id FK
    bool active
  }
  HIRING_APPLICATIONS {
    uuid uuid UK
    string stage_code
    bigint hired_user_id FK_null
  }
```

## Pipeline (conceptual stages)

```mermaid
flowchart LR
  RQ[Requisition draft to approval] --> PO[Posting active window]
  PO --> AP[Application stages]
  AP --> IV[Interviews + scores + minutes]
  AP --> EV[Evaluation]
  EV --> OF[Offer + approvals]
  OF --> CT[Contract]
  CT --> ON[Onboarding tasks]
```

## Approvals touchpoints

```mermaid
flowchart TD
  REQ[Requisition] -->|optional| A1[approval_instance]
  APP[Application] -->|final decision| A2[approval_instance]
  OFF[Offer] -->|optional| A3[approval_instance]
```

When hiring UI ships, link workflow steps to `approval_definitions` the same way other domains do.
