> For the complete documentation index, see [llms.txt](https://docs.snapfix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snapfix.com/engineering-reference/db/tables/tpri_roomstatus_taskrules.md).

# tPri\_RoomStatus\_TaskRules

{% hint style="info" %}
Generated from the staging database schema, with descriptions drafted by agents ([how to read these docs](https://docs.snapfix.com/how-to-read.md)). [Source on GitHub](https://github.com/snapfix/docs/blob/main/spec/db/tables/tPri_RoomStatus_TaskRules.md).
{% endhint %}

## Description

One rule for a building's main and secondary room status, which decides whether a housekeeping cleaning or inspection task is created when a room takes the status (optionally only when it is occupied or reserved), which checklist each task uses, and what happens when the tasks start or finish.

<details>

<summary><strong>Table Definition</strong></summary>

```sql
CREATE TABLE `tPri_RoomStatus_TaskRules` (
  `id` int NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `uuid_tParent` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `uuid_tBuilding` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `uuid_tBuildingRoomStatusMain` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `uuid_tBuildingRoomStatusSecondary` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `onlyWhenRoomOccupiedOrReserved` tinyint DEFAULT '0',
  `uuid_tBusiness_cleaning_task` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `uuid_tBusiness_inspection_task` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `special_rules` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `create_cleaning_task` tinyint DEFAULT '0' COMMENT '1-snapfix should create a housekeeping cleaning task, 0-no action',
  `uuid_tCL_cleaning_task` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL COMMENT 'uuid of the checklist to be used for cleaning task',
  `create_inspection_task` tinyint DEFAULT '0' COMMENT '1-snapfix should create a housekeeping inspection task, 0-no action',
  `uuid_tCL_inspection_task` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL COMMENT 'uuid of the checklist to be used for inspection task',
  `cleaning_task_started_action` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'NULL-no action, rs_{roomstatusuuid}',
  `cleaning_task_completion_action` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL COMMENT 'NULL-no action, inspection-inspection task should be created/unlocked,rs_{roomstatusuuid}',
  `inspection_task_completion_action` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL COMMENT 'NULL-no action, rs_{roomstatusuuid}',
  `fDeleted` tinyint DEFAULT NULL,
  `fCreatedTs` bigint DEFAULT NULL,
  `fModifiedTs` bigint DEFAULT NULL,
  `fServerTs` bigint DEFAULT NULL,
  `uuid_tUser_CreatedBy` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `uuid_tUser_ModifiedBy` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uuid` (`uuid`) USING BTREE,
  KEY `fk_room_status_task_rules_building_room_status_main` (`uuid_tBuildingRoomStatusMain`) USING BTREE,
  KEY `fk_room_status_task_rules_building_room_status_secondary` (`uuid_tBuildingRoomStatusSecondary`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC
```

</details>

## Columns

| Name                                 | Type         | Default | Nullable | Extra Definition | Comment                                                                                                                          |
| ------------------------------------ | ------------ | ------- | -------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| id                                   | int          |         | false    | auto\_increment  |                                                                                                                                  |
| uuid                                 | varchar(255) |         | true     |                  |                                                                                                                                  |
| uuid\_tParent                        | varchar(255) |         | true     |                  |                                                                                                                                  |
| uuid\_tBuilding                      | varchar(255) |         | true     |                  |                                                                                                                                  |
| uuid\_tBuildingRoomStatusMain        | varchar(255) |         | true     |                  |                                                                                                                                  |
| uuid\_tBuildingRoomStatusSecondary   | varchar(255) |         | true     |                  |                                                                                                                                  |
| onlyWhenRoomOccupiedOrReserved       | tinyint      | 0       | true     |                  |                                                                                                                                  |
| uuid\_tBusiness\_cleaning\_task      | varchar(255) |         | true     |                  |                                                                                                                                  |
| uuid\_tBusiness\_inspection\_task    | varchar(255) |         | true     |                  |                                                                                                                                  |
| special\_rules                       | varchar(255) |         | true     |                  | Name of a housekeeping gate that this rule turns on, for example StayCityHousekeepingStayoverTaskGate; NULL or empty means none. |
| create\_cleaning\_task               | tinyint      | 0       | true     |                  | 1 = create a housekeeping cleaning task; 0 = no action.                                                                          |
| uuid\_tCL\_cleaning\_task            | varchar(255) |         | true     |                  | uuid of the checklist to be used for cleaning task                                                                               |
| create\_inspection\_task             | tinyint      | 0       | true     |                  | 1 = create a housekeeping inspection task; 0 = no action.                                                                        |
| uuid\_tCL\_inspection\_task          | varchar(255) |         | true     |                  | uuid of the checklist to be used for inspection task                                                                             |
| cleaning\_task\_started\_action      | varchar(255) |         | true     |                  | NULL-no action, rs\_{roomstatusuuid}                                                                                             |
| cleaning\_task\_completion\_action   | varchar(255) |         | true     |                  | NULL-no action, inspection-inspection task should be created/unlocked,rs\_{roomstatusuuid}                                       |
| inspection\_task\_completion\_action | varchar(255) |         | true     |                  | NULL-no action, rs\_{roomstatusuuid}                                                                                             |
| fDeleted                             | tinyint      |         | true     |                  |                                                                                                                                  |
| fCreatedTs                           | bigint       |         | true     |                  |                                                                                                                                  |
| fModifiedTs                          | bigint       |         | true     |                  |                                                                                                                                  |
| fServerTs                            | bigint       |         | true     |                  |                                                                                                                                  |
| uuid\_tUser\_CreatedBy               | varchar(255) |         | true     |                  |                                                                                                                                  |
| uuid\_tUser\_ModifiedBy              | varchar(255) |         | true     |                  |                                                                                                                                  |

## Viewpoints

| Name                                                                                    | Definition                                                                                                                    |
| --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| [housekeeping](https://docs.snapfix.com/engineering-reference/db/tables/viewpoint-8.md) | Housekeeping: links from a cleaning task to its inspection, room-status task rules, room assignments and staff working hours. |

## Constraints

| Name    | Type        | Definition             |
| ------- | ----------- | ---------------------- |
| PRIMARY | PRIMARY KEY | PRIMARY KEY (id)       |
| uuid    | UNIQUE      | UNIQUE KEY uuid (uuid) |

## Indexes

| Name                                                             | Definition                                                                                                            |
| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| fk\_room\_status\_task\_rules\_building\_room\_status\_main      | KEY fk\_room\_status\_task\_rules\_building\_room\_status\_main (uuid\_tBuildingRoomStatusMain) USING BTREE           |
| fk\_room\_status\_task\_rules\_building\_room\_status\_secondary | KEY fk\_room\_status\_task\_rules\_building\_room\_status\_secondary (uuid\_tBuildingRoomStatusSecondary) USING BTREE |
| PRIMARY                                                          | PRIMARY KEY (id) USING BTREE                                                                                          |
| uuid                                                             | UNIQUE KEY uuid (uuid) USING BTREE                                                                                    |

## Relations

```mermaid
erDiagram


"tPri_RoomStatus_TaskRules" {
  int id PK
}
```

***

> Generated by [tbls](https://github.com/k1LoW/tbls)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.snapfix.com/engineering-reference/db/tables/tpri_roomstatus_taskrules.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
