...
Check transition according to [NEW] Equipment status model
Get equipment by id
Check equipment status
If new status is inactive then current status must be active
If new status is entered_in_error then current status must be active or inactive
in case of error - return 409 ('Invalid transition. Equipment is in final status')
...
Validate $.status is one of the following (
inactive
|entered_in_error
)in case of error - return 422 ("value is not allowed in enum")
If $.status =
inactive
check that deviceequipment.availability_status one of the following (damaged
|destroyed
|lost
)in case of error - return 409 ("It is prohibited to change status for equipment with availability status = {equipment.availability_status}")
...