# UpdateJobProfile

## Permission Scope

`position`

## Overview

UpdateJobProfile updates role metadata — job family, grade reference, requirements, or code — on an existing JobProfile in place.

## Business Rules

- JobProfile is not effective-dated; updates correct the record in place rather than creating a new generation
- `code` uniqueness must be preserved if `code` is changed
- No pay amounts may be introduced onto the JobProfile (ADR-018)
- Structural role change (moving to a different classification) is expressed by re-pointing Positions to a different JobProfile, not by repurposing this one

## Process Flow

```mermaid
flowchart TD
    A[Update JobProfile: job family, grade reference, requirements, code] --> B{JobProfile exists?}
    B -- No --> X[Reject: JOB_PROFILE_NOT_FOUND]
    B -- Yes --> C{Code changed and unique?}
    C -- No --> Y[Reject: DUPLICATE_JOB_PROFILE_CODE]
    C -- Yes --> D[Apply metadata changes in place]
    D --> E[Referencing Positions see updated role metadata]
```

## External Dependencies

- [workforce::JobProfile](../model/JobProfile.md) model — the entity this command mutates
- [workforce::Position](../model/Position.md) model — Positions referencing this JobProfile that are affected by metadata changes

## Error Scenarios

- **JOB_PROFILE_NOT_FOUND**: the specified JobProfile does not exist
- **DUPLICATE_JOB_PROFILE_CODE**: code already exists on another JobProfile

## Test Cases

- updating a JobProfile's job family and requirements persists the change in place
- updating a JobProfile to a code already used by another JobProfile is rejected
- updating a non-existent JobProfile is rejected

