# Data Connect Architecture Guide V.3

## 1. Introduction
This guide consolidates the Data Connect domain documentation into a single reference for engineers, product stakeholders, and QA. Use it to understand the entity relationships, operational flows, and available API operations across the platform.

## 2. Table of Contents
- [System Overview](#system-overview)
- [Identity Domain](#identity-domain)
- [Operations Domain](#operations-domain)
- [Billing Domain](#billing-domain)
- [Teams Domain](#teams-domain)
- [Messaging Domain](#messaging-domain)
- [Compliance Domain](#compliance-domain)
- [Learning Domain](#learning-domain)
- [Sequence Diagrams](#sequence-diagrams)
- [API Catalog](#api-catalog)

## System Overview

### Summary
Summarizes the high-level relationships between core entities in the system.
Highlights the user role model and how orders progress into staffing, assignments, and invoices.
Includes the communication entities that connect users, conversations, and messages.

### Full Content
# System Overview Flowchart

## Description
This flowchart illustrates the high-level relationships between the main entities in the system. It shows the core workflows for user roles, order processing, and communication.

## Flowchart
```mermaid
flowchart LR
    subgraph "User Roles"
        U(User) --> S(Staff)
        U --> V(Vendor)
        U --> B(Business)
    end

    subgraph "Order & Fulfillment"
        B --> O(Order)
        V --> O(Order)
        O --> SH(Shift)
        SH --> APP(Application)
        S --> APP
        APP --> AS(Assignment)
        AS --> I(Invoice)
    end

    subgraph "Communication"
        C(Conversation) --> M(Message)
        UC(UserConversation) --> U
        UC --> C
    end

    style S fill:#f9f,stroke:#333,stroke-width:2px
    style V fill:#ccf,stroke:#333,stroke-width:2px
    style B fill:#cfc,stroke:#333,stroke-width:2px
```

## Identity Domain

### Summary
Explains how users map to staff, vendors, and businesses in the identity model.
Shows the role hierarchy from staff roles to roles and role categories.
Focuses on the core identity relationships used across the platform.

### Full Content
# Identity Domain Flowchart

## Description
Este diagrama de flujo detalla las relaciones de alto nivel entre las entidades de identidad clave del sistema, como usuarios, personal, proveedores, empresas y sus roles asociados.

## Flowchart
```mermaid
flowchart LR
    U(User) --> S(Staff)
    U --> V(Vendor)
    U --> B(Business)

    S --> SR(StaffRole)
    SR --> R(Role)
    R --> RC(RoleCategory)

    style U fill:#f9f,stroke:#333,stroke-width:2px
    style S fill:#ccf,stroke:#333,stroke-width:2px
    style V fill:#cfc,stroke:#333,stroke-width:2px
    style B fill:#ffc,stroke:#333,stroke-width:2px
```

## Operations Domain

### Summary
Describes the operational lifecycle from orders through shifts and applications.
Connects staffing and workforce records to assignments and invoicing outcomes.
Illustrates the end-to-end flow for fulfillment and billing readiness.

### Full Content
# Operations Domain Flowchart

## Description
This flowchart explains the lifecycle of an order, from its creation and staffing to the final invoice generation.

## Flowchart
```mermaid
flowchart TD
    O(Order) --> S(Shift)
    S --> SR(ShiftRole)
    SR --> A(Application)
    U(User) --> A
    A --> W(WorkForce)
    W --> AS(Assignment)
    AS --> I(Invoice)

    style O fill:#f9f,stroke:#333,stroke-width:2px
    style S fill:#ccf,stroke:#333,stroke-width:2px
    style A fill:#cfc,stroke:#333,stroke-width:2px
    style AS fill:#ffc,stroke:#333,stroke-width:2px
    style I fill:#f99,stroke:#333,stroke-width:2px
```

## Billing Domain

### Summary
Centers the billing process on invoices linked to orders, businesses, and vendors.
Shows how recent payments attach to invoices and reference applications for context.
Provides the upstream operational context that feeds billing records.

### Full Content
# Billing Domain Flowchart

## Description
Based on the repository's schema, the billing process centers around the `Invoice` entity. An `Invoice` is generated in the context of an `Order` and is explicitly linked to both a `Business` (the client) and a `Vendor` (the provider). Each invoice captures essential details from these parent entities. Financial transactions are tracked through the `RecentPayment` entity, which is directly tied to a specific `Invoice`, creating a clear record of payments made against that invoice.

## Verified Relationships (evidence)
- `Invoice.vendorId` -> `Vendor.id` (source: `dataconnect/schema/invoice.gql`)
- `Invoice.businessId` -> `Business.id` (source: `dataconnect/schema/invoice.gql`)
- `Invoice.orderId` -> `Order.id` (source: `dataconnect/schema/invoice.gql`)
- `RecentPayment.invoiceId` -> `Invoice.id` (source: `dataconnect/schema/recentPayment.gql`)
- `RecentPayment.applicationId` -> `Application.id` (source: `dataconnect/schema/recentPayment.gql`)

## Flowchart
```mermaid
flowchart TD
  %% -----------------------------
  %% Billing Core
  %% -----------------------------
  B(Business) --> O(Order)
  V(Vendor) --> O
  O --> I(Invoice)
  I --> RP(RecentPayment)
  A(Application) --> RP

  %% -----------------------------
  %% Upstream Operations (Context)
  %% -----------------------------
  subgraph OPS[Upstream Operations Context]
    O --> S(Shift)
    S --> SR(ShiftRole)
    SR --> A
    ST(Staff) --> A
    A --> AS(Assignment)
    W(Workforce) --> AS
    ST --> W
  end
```

## Teams Domain

### Summary
Details how teams, members, hubs, and departments structure organizational data.
Covers task management via tasks, member assignments, and task comments.
Notes verified and missing relationships that affect traceability in the schema.

### Full Content
# Teams Domain Flowchart

## Description
The Teams domain in this repository organizes users and their associated tasks. The `Team` is the central entity, with a `User` joining via the `TeamMember` join table, which defines their role. Teams can be structured using `TeamHub` (locations) and `TeamHudDepartment` (departments). The domain also includes task management. A `Task` can be assigned to a `TeamMember` through the `MemberTask` entity. Communication on tasks is handled by `TaskComment`, which is linked directly to the `TeamMember` who made the comment, providing a clear link between team structure and actionable work.

## Entities in Scope
- Team
- TeamMember
- User
- TeamHub
- TeamHudDepartment
- Task
- MemberTask
- TaskComment

## Verified Relationships (evidence)
- `TeamMember.teamId` -> `Team.id` (source: `dataconnect/schema/teamMember.gql`)
- `TeamMember.userId` -> `User.id` (source: `dataconnect/schema/teamMember.gql`)
- `TeamMember.teamHubId` -> `TeamHub.id` (source: `dataconnect/schema/teamMember.gql`)
- `TeamHub.teamId` -> `Team.id` (source: `dataconnect/schema/teamHub.gql`, implicit via field name)
- `TeamHudDepartment.teamHubId` -> `TeamHub.id` (source: `dataconnect/schema/teamHudDeparment.gql`)
- `MemberTask.teamMemberId` -> `TeamMember.id` (source: `dataconnect/schema/memberTask.gql`)
- `MemberTask.taskId` -> `Task.id` (source: `dataconnect/schema/memberTask.gql`)
- `TaskComment.teamMemberId` -> `TeamMember.id` (source: `dataconnect/schema/task_comment.gql`)
- Not found: `Team.ownerId` is a generic `String` and does not have a `@ref` to `Vendor` or `Business`.
- Not found: `TaskComment.taskId` exists but has no `@ref` to `Task.id`.

## Flowchart
```mermaid
---
config:
  layout: elk
---
---
config:
  layout: elk
---
flowchart TB
  subgraph STRUCTURE[Team Structure]
    T(Team) --> TM(TeamMember)
    T --> TH(TeamHub)
    TH --> THD(TeamHudDepartment)
    U(User) --> TM
    TM --> TH
  end

  subgraph WORK[Work & Tasks]
    TK(Task) --> MT(MemberTask)
    TM --> MT
    TM --> TC(TaskComment)
    TK --> TC
  end

```

## Messaging Domain

### Summary
Defines conversations as the container for chat metadata and history.
Links messages and user participation through user conversations.
Distinguishes verified and inferred relationships between entities.

### Full Content
# Messaging Domain Flowchart

## Description
The messaging system is designed around three core entities. The `Conversation` entity acts as the central container, holding metadata about a specific chat, such as its subject and type (e.g., group chat, client-vendor). The actual content of the conversation is stored in the `Message` entity, where each message is linked to its parent `Conversation` and the `User` who sent it. To track the state for each participant, the `UserConversation` entity links a `User` to a `Conversation` and stores per-user data, such as the number of unread messages and when they last read the chat.

## Entities in Scope
- Conversation
- Message
- UserConversation
- User

## Verified Relationships (evidence)
- `Message.senderId` -> `User.id` (source: `dataconnect/schema/message.gql`)
- `UserConversation.conversationId` -> `Conversation.id` (source: `dataconnect/schema/userConversation.gql`)
- `UserConversation.userId` -> `User.id` (source: `dataconnect/schema/userConversation.gql`)

## Inferred Relationships (if any)
- `Message.conversationId` -> `Conversation.id` (source: `dataconnect/schema/message.gql`, inferred from field name)

## Flowchart
```mermaid
flowchart TB
    subgraph "Conversation Metadata"
        C(Conversation)
    end

    subgraph "Message Content & User State"
        M(Message)
        UC(UserConversation)
        U(User)
    end

    C -- Inferred --- M
    C -- Verified --- UC

    U -- Verified --- UC
    U -- Verified --- M
```

## Compliance Domain

### Summary
Explains how staff compliance is tracked through documents and submissions.
Includes required documents, tax forms, and certificates tied to staff records.
Separates verified links from inferred relationships for compliance entities.

### Full Content
# Compliance Domain Flowchart

## Description
The compliance domain manages the necessary documentation and certifications for staff members. The system defines a list of document types via the `Document` entity. Staff members submit their compliance files through `StaffDocument`, which links a specific staff member to a generic document definition. Additionally, `RequiredDoc`, `TaxForm`, and `Certificate` entities are used to track other specific compliance items, such as mandatory documents, tax forms (like W-4s), and professional certificates, all of which are linked back to a particular staff member.

## Entities in Scope
- Document
- StaffDocument
- RequiredDoc
- TaxForm
- Certificate
- Staff

## Verified Relationships (evidence)
- `StaffDocument.documentId` -> `Document.id` (source: `dataconnect/schema/staffDocument.gql`)
- `Certificate.staffId` -> `Staff.id` (source: `dataconnect/schema/certificate.gql`)

## Inferred Relationships (if any)
- `StaffDocument.staffId` -> `Staff.id` (source: `dataconnect/schema/staffDocument.gql`, inferred from field name)
- `RequiredDoc.staffId` -> `Staff.id` (source: `dataconnect/schema/requiredDoc.gql`, inferred from field name)
- `TaxForm.staffId` -> `Staff.id` (source: `dataconnect/schema/taxForm.gql`, inferred from field name)

## Flowchart
```mermaid
flowchart TB
 subgraph subGraph0["Compliance Requirements"]
        D("Document")
  end
 subgraph subGraph1["Staff Submissions & Documents"]
        S("Staff")
        SD("StaffDocument")
        TF("TaxForm")
        C("Certificate")
  end
    D -- Verified --> SD
    S -- Inferred --> SD & TF
    S -- Verified --> C
```

## Learning Domain

### Summary
Outlines the training model with courses, categories, and levels.
Shows how staff progress is captured via staff course records.
Calls out relationships that are inferred versus explicitly modeled.

### Full Content
# Learning Domain Flowchart

## Description
The learning domain provides a structured training system for staff. The core component is the `Course`, which represents an individual training module with a title, description, and associated `Category`. While the `Level` entity exists to define progression tiers (e.g., based on experience points), it is not directly linked to courses in the current schema. The `StaffCourse` entity tracks the progress of a staff member in a specific course, recording their completion status and timestamps. Certificates are not explicitly linked to course completion in the schema.

## Entities in Scope
- Course
- Category
- Level
- StaffCourse
- Staff

## Verified Relationships (evidence)
- `Course.categoryId` -> `Category.id` (source: `dataconnect/schema/course.gql`)

## Inferred Relationships (if any)
- `StaffCourse.staffId` -> `Staff.id` (source: `dataconnect/schema/staffCourse.gql`, inferred from field name)
- `StaffCourse.courseId` -> `Course.id` (source: `dataconnect/schema/staffCourse.gql`, inferred from field name)

## Flowchart
```mermaid
flowchart TB
    subgraph "Training Structure"
        C(Course)
        CAT(Category)
        L(Level)
    end

    subgraph "Staff Participation"
        S(Staff)
        SC(StaffCourse)
    end

    CAT -- Verified --> C

    S -- Verified --> SC
    C -- Verified --> SC
```

## Sequence Diagrams

### Summary
Walks through the order-to-invoice sequence based on connector operations.
Lists the verified mutation steps that drive the operational flow.
Visualizes participant interactions from creation through billing.

### Full Content
# Operations Sequence Diagrams

## Flow 1: Order to Invoice

### Description
Based on the repository's connector operations, the operational flow begins when a user creates an `Order`. From this order, one or more `Shifts` are generated. A `Staff` member can then apply to a specific `Shift`, creating an `Application`. Subsequently, an `Assignment` is created, linking a `Workforce` member to that `Shift`. While this represents the staffing and fulfillment part of the process, the billing cycle is handled separately. An `Invoice` is generated directly from the parent `Order`, rather than from the individual assignments, consolidating all billing at the order level.

### Verified Steps (Evidence)
- `createOrder` (source: `dataconnect/connector/order/mutations.gql`)
- `createShift` (source: `dataconnect/connector/shift/mutations.gql`)
- `createShiftRole` (source: `dataconnect/connector/shiftRole/mutations.gql`)
- `createApplication` (source: `dataconnect/connector/application/mutations.gql`)
- `CreateAssignment` (source: `dataconnect/connector/assignment/mutations.gql`)
- `createInvoice` (source: `dataconnect/connector/invoice/mutations.gql`)

### Sequence Diagram
```mermaid
sequenceDiagram
    participant Business as Business (Client)
    participant Vendor as Vendor (Provider)
    participant Order
    participant Shift
    participant ShiftRole
    participant Staff
    participant Application
    participant Workforce
    participant Assignment
    participant Invoice

    Business->>Order: createOrder(businessId, vendorId, ...)
    Order-->>Business: Order created (orderId)

    Vendor->>Shift: createShift(orderId, ...)
    Shift-->>Vendor: Shift created (shiftId)

    Vendor->>ShiftRole: createShiftRole(shiftId, roleId, workersNeeded, rate, ...)
    ShiftRole-->>Vendor: ShiftRole created (shiftRoleId)

    Staff->>Application: createApplication(shiftId OR shiftRoleId, staffId, ...)
    Application-->>Staff: Application submitted (applicationId)

    Vendor->>Workforce: createWorkforce(applicationId / staffId / shiftId, ...)
    Workforce-->>Vendor: Workforce created (workforceId)

    Vendor->>Assignment: createAssignment(shiftId, workforceId, staffId, ...)
    Assignment-->>Vendor: Assignment created (assignmentId)

    Vendor->>Invoice: createInvoice(orderId, businessId, vendorId, ...)
    Invoice-->>Vendor: Invoice created (invoiceId)

```

## API Catalog

### Summary
Lists every GraphQL query and mutation in the Data Connect connectors.
Provides parameters and top-level return/affect fields for each operation.
Organizes operations by entity folder for quick discovery and reference.

### Full Content
# API Catalog – Data Connect

## Overview
This catalog enumerates every GraphQL query and mutation defined in the Data Connect connector folders under `prototypes/dataconnect/connector/`. Use it to discover available operations, required parameters, and the top-level fields returned or affected by each operation.

## account

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listAccounts` | List accounts | — | `accounts` |
| `getAccountById` | Get account by id | `$id: UUID!` | `account` |
| `getAccountsByOwnerId` | Get accounts by owner id | `$ownerId: UUID!` | `accounts` |
| `filterAccounts` | Filter accounts | `$bank: String`<br>`$type: AccountType`<br>`$isPrimary: Boolean`<br>`$ownerId: UUID` | `accounts` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createAccount` | Create account | `$bank: String!`<br>`$type: AccountType!`<br>`$last4: String!`<br>`$isPrimary: Boolean`<br>`$ownerId: UUID!`<br>`$accountNumber: String`<br>`$routeNumber: String`<br>`$expiryTime: Timestamp` | `account_insert` |
| `updateAccount` | Update account | `$id: UUID!`<br>`$bank: String`<br>`$type: AccountType`<br>`$last4: String`<br>`$isPrimary: Boolean`<br>`$accountNumber: String`<br>`$routeNumber: String`<br>`$expiryTime: Timestamp` | `account_update` |
| `deleteAccount` | Delete account | `$id: UUID!` | `account_delete` |

## activityLog

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listActivityLogs` | List activity logs | `$offset: Int`<br>`$limit: Int` | `activityLogs` |
| `getActivityLogById` | Get activity log by id | `$id: UUID!` | `activityLog` |
| `listActivityLogsByUserId` | List activity logs by user id | `$userId: String!`<br>`$offset: Int`<br>`$limit: Int` | `activityLogs` |
| `listUnreadActivityLogsByUserId` | List unread activity logs by user id | `$userId: String!`<br>`$offset: Int`<br>`$limit: Int` | `activityLogs` |
| `filterActivityLogs` | Filter activity logs | `$userId: String`<br>`$dateFrom: Timestamp`<br>`$dateTo: Timestamp`<br>`$isRead: Boolean`<br>`$activityType: ActivityType`<br>`$iconType: ActivityIconType`<br>`$offset: Int`<br>`$limit: Int` | `activityLogs` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createActivityLog` | Create activity log | `$userId: String!`<br>`$date: Timestamp!`<br>`$hourStart: String`<br>`$hourEnd: String`<br>`$totalhours: String`<br>`$iconType: ActivityIconType`<br>`$iconColor: String`<br>`$title: String!`<br>`$description: String!`<br>`$isRead: Boolean`<br>`$activityType: ActivityType!` | `activityLog_insert` |
| `updateActivityLog` | Update activity log | `$id: UUID!`<br>`$userId: String`<br>`$date: Timestamp`<br>`$hourStart: String`<br>`$hourEnd: String`<br>`$totalhours: String`<br>`$iconType: ActivityIconType`<br>`$iconColor: String`<br>`$title: String`<br>`$description: String`<br>`$isRead: Boolean`<br>`$activityType: ActivityType` | `activityLog_update` |
| `markActivityLogAsRead` | Mark activity log as read | `$id: UUID!` | `activityLog_update` |
| `markActivityLogsAsRead` | Mark activity logs as read | `$ids: [UUID!]!` | `activityLog_updateMany` |
| `deleteActivityLog` | Delete activity log | `$id: UUID!` | `activityLog_delete` |

## application

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listApplications` | List applications | — | `applications` |
| `getApplicationById` | Get application by id | `$id: UUID!` | `application` |
| `getApplicationsByShiftId` | Get applications by shift id | `$shiftId: UUID!` | `applications` |
| `getApplicationsByShiftIdAndStatus` | Get applications by shift id and status | `$shiftId: UUID!`<br>`$status: ApplicationStatus!`<br>`$offset: Int`<br>`$limit: Int` | `applications` |
| `getApplicationsByStaffId` | Get applications by staff id | `$staffId: UUID!`<br>`$offset: Int`<br>`$limit: Int`<br>`$dayStart: Timestamp`<br>`$dayEnd: Timestamp` | `applications` |
| `vaidateDayStaffApplication` | Vaidate day staff application | `$staffId: UUID!`<br>`$offset: Int`<br>`$limit: Int`<br>`$dayStart: Timestamp`<br>`$dayEnd: Timestamp` | `applications` |
| `getApplicationByStaffShiftAndRole` | Get application by staff shift and role | `$staffId: UUID!`<br>`$shiftId: UUID!`<br>`$roleId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `applications` |
| `listAcceptedApplicationsByShiftRoleKey` | List accepted applications by shift role key | `$shiftId: UUID!`<br>`$roleId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `applications` |
| `listAcceptedApplicationsByBusinessForDay` | List accepted applications by business for day | `$businessId: UUID!`<br>`$dayStart: Timestamp!`<br>`$dayEnd: Timestamp!`<br>`$offset: Int`<br>`$limit: Int` | `applications` |
| `listStaffsApplicationsByBusinessForDay` | List staffs applications by business for day | `$businessId: UUID!`<br>`$dayStart: Timestamp!`<br>`$dayEnd: Timestamp!`<br>`$offset: Int`<br>`$limit: Int` | `applications` |
| `listCompletedApplicationsByStaffId` | List completed applications by staff id | `$staffId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `applications` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createApplication` | Create application | `$shiftId: UUID!`<br>`$staffId: UUID!`<br>`$status: ApplicationStatus!`<br>`$checkInTime: Timestamp`<br>`$checkOutTime: Timestamp`<br>`$origin: ApplicationOrigin!`<br>`$roleId: UUID!` | `application_insert` |
| `updateApplicationStatus` | Update application status | `$id: UUID!`<br>`$shiftId: UUID`<br>`$staffId: UUID`<br>`$status: ApplicationStatus`<br>`$checkInTime: Timestamp`<br>`$checkOutTime: Timestamp`<br>`$roleId: UUID` | `application_update` |
| `deleteApplication` | Delete application | `$id: UUID!` | `application_delete` |

## assignment

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listAssignments` | List assignments | `$offset: Int`<br>`$limit: Int` | `assignments` |
| `getAssignmentById` | Get assignment by id | `$id: UUID!` | `assignment` |
| `listAssignmentsByWorkforceId` | List assignments by workforce id | `$workforceId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `assignments` |
| `listAssignmentsByWorkforceIds` | List assignments by workforce ids | `$workforceIds: [UUID!]!`<br>`$offset: Int`<br>`$limit: Int` | `assignments` |
| `listAssignmentsByShiftRole` | List assignments by shift role | `$shiftId: UUID!`<br>`$roleId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `assignments` |
| `represents` | Represents | — | `assignments` |
| `filterAssignments` | Filter assignments | `$shiftIds: [UUID!]!`<br>`$roleIds: [UUID!]!`<br>`$status: AssignmentStatus`<br>`$offset: Int`<br>`$limit: Int` | `assignments` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `CreateAssignment` | Create assignment | `$workforceId: UUID!`<br>`$title: String`<br>`$description: String`<br>`$instructions: String`<br>`$status: AssignmentStatus`<br>`$tipsAvailable: Boolean`<br>`$travelTime: Boolean`<br>`$mealProvided: Boolean`<br>`$parkingAvailable: Boolean`<br>`$gasCompensation: Boolean`<br>`$managers: [Any!]`<br>`$roleId: UUID!`<br>`$shiftId: UUID!` | `assignment_insert` |
| `UpdateAssignment` | Update assignment | `$id: UUID!`<br>`$title: String`<br>`$description: String`<br>`$instructions: String`<br>`$status: AssignmentStatus`<br>`$tipsAvailable: Boolean`<br>`$travelTime: Boolean`<br>`$mealProvided: Boolean`<br>`$parkingAvailable: Boolean`<br>`$gasCompensation: Boolean`<br>`$managers: [Any!]`<br>`$roleId: UUID!`<br>`$shiftId: UUID!` | `assignment_update` |
| `DeleteAssignment` | Delete assignment | `$id: UUID!` | `assignment_delete` |

## attireOption

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listAttireOptions` | List attire options | — | `attireOptions` |
| `getAttireOptionById` | Get attire option by id | `$id: UUID!` | `attireOption` |
| `filterAttireOptions` | Filter attire options | `$itemId: String`<br>`$isMandatory: Boolean`<br>`$vendorId: UUID` | `attireOptions` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createAttireOption` | Create attire option | `$itemId: String!`<br>`$label: String!`<br>`$icon: String`<br>`$imageUrl: String`<br>`$isMandatory: Boolean`<br>`$vendorId: UUID` | `attireOption_insert` |
| `updateAttireOption` | Update attire option | `$id: UUID!`<br>`$itemId: String`<br>`$label: String`<br>`$icon: String`<br>`$imageUrl: String`<br>`$isMandatory: Boolean`<br>`$vendorId: UUID` | `attireOption_update` |
| `deleteAttireOption` | Delete attire option | `$id: UUID!` | `attireOption_delete` |

## benefitsData

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listBenefitsData` | List benefits data | `$offset: Int`<br>`$limit: Int` | `benefitsDatas` |
| `getBenefitsDataByKey` | Get benefits data by key | `$staffId: UUID!`<br>`$vendorBenefitPlanId: UUID!` | `benefitsData` |
| `listBenefitsDataByStaffId` | List benefits data by staff id | `$staffId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `benefitsDatas` |
| `listBenefitsDataByVendorBenefitPlanId` | List benefits data by vendor benefit plan id | `$vendorBenefitPlanId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `benefitsDatas` |
| `listBenefitsDataByVendorBenefitPlanIds` | List benefits data by vendor benefit plan ids | `$vendorBenefitPlanIds: [UUID!]!`<br>`$offset: Int`<br>`$limit: Int` | `benefitsDatas` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createBenefitsData` | Create benefits data | `$vendorBenefitPlanId: UUID!`<br>`$staffId: UUID!`<br>`$current: Int!` | `benefitsData_insert` |
| `updateBenefitsData` | Update benefits data | `$staffId: UUID!`<br>`$vendorBenefitPlanId: UUID!`<br>`$current: Int` | `benefitsData_update` |
| `deleteBenefitsData` | Delete benefits data | `$staffId: UUID!`<br>`$vendorBenefitPlanId: UUID!` | `benefitsData_delete` |

## business

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listBusinesses` | List businesses | — | `businesses` |
| `getBusinessesByUserId` | Get businesses by user id | `$userId: String!` | `businesses` |
| `getBusinessById` | Get business by id | `$id: UUID!` | `business` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createBusiness` | Create business | `$businessName: String!`<br>`$contactName: String`<br>`$userId: String!`<br>`$companyLogoUrl: String`<br>`$phone: String`<br>`$email: String`<br>`$hubBuilding: String`<br>`$address: String`<br>`$placeId: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$city: String`<br>`$state: String`<br>`$street: String`<br>`$country: String`<br>`$zipCode: String`<br>`$area: BusinessArea`<br>`$sector: BusinessSector`<br>`$rateGroup: BusinessRateGroup!`<br>`$status: BusinessStatus!`<br>`$notes: String` | `business_insert` |
| `updateBusiness` | Update business | `$id: UUID!`<br>`$businessName: String`<br>`$contactName: String`<br>`$companyLogoUrl: String`<br>`$phone: String`<br>`$email: String`<br>`$hubBuilding: String`<br>`$address: String`<br>`$placeId: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$city: String`<br>`$state: String`<br>`$street: String`<br>`$country: String`<br>`$zipCode: String`<br>`$area: BusinessArea`<br>`$sector: BusinessSector`<br>`$rateGroup: BusinessRateGroup`<br>`$status: BusinessStatus`<br>`$notes: String` | `business_update` |
| `deleteBusiness` | Delete business | `$id: UUID!` | `business_delete` |

## category

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listCategories` | List categories | — | `categories` |
| `getCategoryById` | Get category by id | `$id: UUID!` | `category` |
| `filterCategories` | Filter categories | `$categoryId: String`<br>`$label: String` | `categories` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createCategory` | Create category | `$categoryId: String!`<br>`$label: String!`<br>`$icon: String` | `category_insert` |
| `updateCategory` | Update category | `$id: UUID!`<br>`$categoryId: String`<br>`$label: String`<br>`$icon: String` | `category_update` |
| `deleteCategory` | Delete category | `$id: UUID!` | `category_delete` |

## certificate

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listCertificates` | List certificates | — | `certificates` |
| `getCertificateById` | Get certificate by id | `$id: UUID!` | `certificate` |
| `listCertificatesByStaffId` | List certificates by staff id | `$staffId: UUID!` | `certificates` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `CreateCertificate` | Create certificate | `$name: String!`<br>`$description: String`<br>`$expiry: Timestamp`<br>`$status: CertificateStatus!`<br>`$fileUrl: String`<br>`$icon: String`<br>`$certificationType: ComplianceType`<br>`$issuer: String`<br>`$staffId: UUID!`<br>`$validationStatus: ValidationStatus`<br>`$certificateNumber: String` | `certificate_insert` |
| `UpdateCertificate` | Update certificate | `$id: UUID!`<br>`$name: String`<br>`$description: String`<br>`$expiry: Timestamp`<br>`$status: CertificateStatus`<br>`$fileUrl: String`<br>`$icon: String`<br>`$staffId: UUID`<br>`$certificationType: ComplianceType`<br>`$issuer: String`<br>`$validationStatus: ValidationStatus`<br>`$certificateNumber: String` | `certificate_update` |
| `DeleteCertificate` | Delete certificate | `$id: UUID!` | `certificate_delete` |

## clientFeedback

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listClientFeedbacks` | List client feedbacks | `$offset: Int`<br>`$limit: Int` | `clientFeedbacks` |
| `getClientFeedbackById` | Get client feedback by id | `$id: UUID!` | `clientFeedback` |
| `listClientFeedbacksByBusinessId` | List client feedbacks by business id | `$businessId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `clientFeedbacks` |
| `listClientFeedbacksByVendorId` | List client feedbacks by vendor id | `$vendorId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `clientFeedbacks` |
| `listClientFeedbacksByBusinessAndVendor` | List client feedbacks by business and vendor | `$businessId: UUID!`<br>`$vendorId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `clientFeedbacks` |
| `filterClientFeedbacks` | Filter client feedbacks | `$businessId: UUID`<br>`$vendorId: UUID`<br>`$ratingMin: Int`<br>`$ratingMax: Int`<br>`$dateFrom: Timestamp`<br>`$dateTo: Timestamp`<br>`$offset: Int`<br>`$limit: Int` | `clientFeedbacks` |
| `listClientFeedbackRatingsByVendorId` | List client feedback ratings by vendor id | `$vendorId: UUID!`<br>`$dateFrom: Timestamp`<br>`$dateTo: Timestamp` | `clientFeedbacks` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createClientFeedback` | Create client feedback | `$businessId: UUID!`<br>`$vendorId: UUID!`<br>`$rating: Int`<br>`$comment: String`<br>`$date: Timestamp`<br>`$createdBy: String` | `clientFeedback_insert` |
| `updateClientFeedback` | Update client feedback | `$id: UUID!`<br>`$businessId: UUID`<br>`$vendorId: UUID`<br>`$rating: Int`<br>`$comment: String`<br>`$date: Timestamp`<br>`$createdBy: String` | `clientFeedback_update` |
| `deleteClientFeedback` | Delete client feedback | `$id: UUID!` | `clientFeedback_delete` |

## conversation

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listConversations` | List conversations | `$offset: Int`<br>`$limit: Int` | `conversations` |
| `getConversationById` | Get conversation by id | `$id: UUID!` | `conversation` |
| `listConversationsByType` | List conversations by type | `$conversationType: ConversationType!`<br>`$offset: Int`<br>`$limit: Int` | `conversations` |
| `listConversationsByStatus` | List conversations by status | `$status: ConversationStatus!`<br>`$offset: Int`<br>`$limit: Int` | `conversations` |
| `filterConversations` | Filter conversations | `$status: ConversationStatus`<br>`$conversationType: ConversationType`<br>`$isGroup: Boolean`<br>`$lastMessageAfter: Timestamp`<br>`$lastMessageBefore: Timestamp`<br>`$offset: Int`<br>`$limit: Int` | `conversations` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createConversation` | Create conversation | `$subject: String`<br>`$status: ConversationStatus`<br>`$conversationType: ConversationType`<br>`$isGroup: Boolean`<br>`$groupName: String`<br>`$lastMessage: String`<br>`$lastMessageAt: Timestamp` | `conversation_insert` |
| `updateConversation` | Update conversation | `$id: UUID!`<br>`$subject: String`<br>`$status: ConversationStatus`<br>`$conversationType: ConversationType`<br>`$isGroup: Boolean`<br>`$groupName: String`<br>`$lastMessage: String`<br>`$lastMessageAt: Timestamp` | `conversation_update` |
| `updateConversationLastMessage` | Update conversation last message | `$id: UUID!`<br>`$lastMessage: String`<br>`$lastMessageAt: Timestamp` | `conversation_update` |
| `deleteConversation` | Delete conversation | `$id: UUID!` | `conversation_delete` |

## course

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listCourses` | List courses | — | `courses` |
| `getCourseById` | Get course by id | `$id: UUID!` | `course` |
| `filterCourses` | Filter courses | `$categoryId: UUID`<br>`$isCertification: Boolean`<br>`$levelRequired: String`<br>`$completed: Boolean` | `courses` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createCourse` | Create course | `$title: String`<br>`$description: String`<br>`$thumbnailUrl: String`<br>`$durationMinutes: Int`<br>`$xpReward: Int`<br>`$categoryId: UUID!`<br>`$levelRequired: String`<br>`$isCertification: Boolean` | `course_insert` |
| `updateCourse` | Update course | `$id: UUID!`<br>`$title: String`<br>`$description: String`<br>`$thumbnailUrl: String`<br>`$durationMinutes: Int`<br>`$xpReward: Int`<br>`$categoryId: UUID!`<br>`$levelRequired: String`<br>`$isCertification: Boolean` | `course_update` |
| `deleteCourse` | Delete course | `$id: UUID!` | `course_delete` |

## customRateCard

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listCustomRateCards` | List custom rate cards | — | `customRateCards` |
| `getCustomRateCardById` | Get custom rate card by id | `$id: UUID!` | `customRateCard` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createCustomRateCard` | Create custom rate card | `$name: String!`<br>`$baseBook: String`<br>`$discount: Float`<br>`$isDefault: Boolean` | `customRateCard_insert` |
| `updateCustomRateCard` | Update custom rate card | `$id: UUID!`<br>`$name: String`<br>`$baseBook: String`<br>`$discount: Float`<br>`$isDefault: Boolean` | `customRateCard_update` |
| `deleteCustomRateCard` | Delete custom rate card | `$id: UUID!` | `customRateCard_delete` |

## document

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listDocuments` | List documents | — | `documents` |
| `getDocumentById` | Get document by id | `$id: UUID!` | `document` |
| `filterDocuments` | Filter documents | `$documentType: DocumentType` | `documents` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createDocument` | Create document | `$documentType: DocumentType!`<br>`$name: String!`<br>`$description: String` | `document_insert` |
| `updateDocument` | Update document | `$id: UUID!`<br>`$documentType: DocumentType`<br>`$name: String`<br>`$description: String` | `document_update` |
| `deleteDocument` | Delete document | `$id: UUID!` | `document_delete` |

## emergencyContact

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listEmergencyContacts` | List emergency contacts | — | `emergencyContacts` |
| `getEmergencyContactById` | Get emergency contact by id | `$id: UUID!` | `emergencyContact` |
| `getEmergencyContactsByStaffId` | Get emergency contacts by staff id | `$staffId: UUID!` | `emergencyContacts` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createEmergencyContact` | Create emergency contact | `$name: String!`<br>`$phone: String!`<br>`$relationship: RelationshipType!`<br>`$staffId: UUID!` | `emergencyContact_insert` |
| `updateEmergencyContact` | Update emergency contact | `$id: UUID!`<br>`$name: String`<br>`$phone: String`<br>`$relationship: RelationshipType` | `emergencyContact_update` |
| `deleteEmergencyContact` | Delete emergency contact | `$id: UUID!` | `emergencyContact_delete` |

## faqData

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listFaqDatas` | List faq datas | — | `faqDatas` |
| `getFaqDataById` | Get faq data by id | `$id: UUID!` | `faqData` |
| `filterFaqDatas` | Filter faq datas | `$category: String` | `faqDatas` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createFaqData` | Create faq data | `$category: String!`<br>`$questions: [Any!]` | `faqData_insert` |
| `updateFaqData` | Update faq data | `$id: UUID!`<br>`$category: String`<br>`$questions: [Any!]` | `faqData_update` |
| `deleteFaqData` | Delete faq data | `$id: UUID!` | `faqData_delete` |

## hub

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listHubs` | List hubs | — | `hubs` |
| `getHubById` | Get hub by id | `$id: UUID!` | `hub` |
| `getHubsByOwnerId` | Get hubs by owner id | `$ownerId: UUID!` | `hubs` |
| `filterHubs` | Filter hubs | `$ownerId: UUID`<br>`$name: String`<br>`$nfcTagId: String` | `hubs` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createHub` | Create hub | `$name: String!`<br>`$locationName: String`<br>`$address: String`<br>`$nfcTagId: String`<br>`$ownerId: UUID!` | `hub_insert` |
| `updateHub` | Update hub | `$id: UUID!`<br>`$name: String`<br>`$locationName: String`<br>`$address: String`<br>`$nfcTagId: String`<br>`$ownerId: UUID` | `hub_update` |
| `deleteHub` | Delete hub | `$id: UUID!` | `hub_delete` |

## invoice

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listInvoices` | List invoices | `$offset: Int`<br>`$limit: Int` | `invoices` |
| `getInvoiceById` | Get invoice by id | `$id: UUID!` | `invoice` |
| `listInvoicesByVendorId` | List invoices by vendor id | `$vendorId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `invoices` |
| `listInvoicesByBusinessId` | List invoices by business id | `$businessId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `invoices` |
| `listInvoicesByOrderId` | List invoices by order id | `$orderId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `invoices` |
| `listInvoicesByStatus` | List invoices by status | `$status: InvoiceStatus!`<br>`$offset: Int`<br>`$limit: Int` | `invoices` |
| `filterInvoices` | Filter invoices | `$vendorId: UUID`<br>`$businessId: UUID`<br>`$orderId: UUID`<br>`$status: InvoiceStatus`<br>`$issueDateFrom: Timestamp`<br>`$issueDateTo: Timestamp`<br>`$dueDateFrom: Timestamp`<br>`$dueDateTo: Timestamp`<br>`$offset: Int`<br>`$limit: Int` | `invoices` |
| `listOverdueInvoices` | List overdue invoices | `$now: Timestamp!`<br>`$offset: Int`<br>`$limit: Int` | `invoices` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createInvoice` | Create invoice | `$status: InvoiceStatus!`<br>`$vendorId: UUID!`<br>`$businessId: UUID!`<br>`$orderId: UUID!`<br>`$paymentTerms: InovicePaymentTerms`<br>`$invoiceNumber: String!`<br>`$issueDate: Timestamp!`<br>`$dueDate: Timestamp!`<br>`$hub: String`<br>`$managerName: String`<br>`$vendorNumber: String`<br>`$roles: Any`<br>`$charges: Any`<br>`$otherCharges: Float`<br>`$subtotal: Float`<br>`$amount: Float!`<br>`$notes: String`<br>`$staffCount: Int`<br>`$chargesCount: Int` | `invoice_insert` |
| `updateInvoice` | Update invoice | `$id: UUID!`<br>`$status: InvoiceStatus`<br>`$vendorId: UUID`<br>`$businessId: UUID`<br>`$orderId: UUID`<br>`$paymentTerms: InovicePaymentTerms`<br>`$invoiceNumber: String`<br>`$issueDate: Timestamp`<br>`$dueDate: Timestamp`<br>`$hub: String`<br>`$managerName: String`<br>`$vendorNumber: String`<br>`$roles: Any`<br>`$charges: Any`<br>`$otherCharges: Float`<br>`$subtotal: Float`<br>`$amount: Float`<br>`$notes: String`<br>`$staffCount: Int`<br>`$chargesCount: Int`<br>`$disputedItems: Any`<br>`$disputeReason: String`<br>`$disputeDetails: String` | `invoice_update` |
| `deleteInvoice` | Delete invoice | `$id: UUID!` | `invoice_delete` |

## invoiceTemplate

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listInvoiceTemplates` | List invoice templates | `$offset: Int`<br>`$limit: Int` | `invoiceTemplates` |
| `getInvoiceTemplateById` | Get invoice template by id | `$id: UUID!` | `invoiceTemplate` |
| `listInvoiceTemplatesByOwnerId` | List invoice templates by owner id | `$ownerId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `invoiceTemplates` |
| `listInvoiceTemplatesByVendorId` | List invoice templates by vendor id | `$vendorId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `invoiceTemplates` |
| `listInvoiceTemplatesByBusinessId` | List invoice templates by business id | `$businessId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `invoiceTemplates` |
| `listInvoiceTemplatesByOrderId` | List invoice templates by order id | `$orderId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `invoiceTemplates` |
| `searchInvoiceTemplatesByOwnerAndName` | Search invoice templates by owner and name | `$ownerId: UUID!`<br>`$name: String!`<br>`$offset: Int`<br>`$limit: Int` | `invoiceTemplates` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createInvoiceTemplate` | Create invoice template | `$name: String!`<br>`$ownerId: UUID!`<br>`$vendorId: UUID`<br>`$businessId: UUID`<br>`$orderId: UUID`<br>`$paymentTerms: InovicePaymentTermsTemp`<br>`$invoiceNumber: String`<br>`$issueDate: Timestamp`<br>`$dueDate: Timestamp`<br>`$hub: String`<br>`$managerName: String`<br>`$vendorNumber: String`<br>`$roles: Any`<br>`$charges: Any`<br>`$otherCharges: Float`<br>`$subtotal: Float`<br>`$amount: Float`<br>`$notes: String`<br>`$staffCount: Int`<br>`$chargesCount: Int` | `invoiceTemplate_insert` |
| `updateInvoiceTemplate` | Update invoice template | `$id: UUID!`<br>`$name: String`<br>`$ownerId: UUID`<br>`$vendorId: UUID`<br>`$businessId: UUID`<br>`$orderId: UUID`<br>`$paymentTerms: InovicePaymentTermsTemp`<br>`$invoiceNumber: String`<br>`$issueDate: Timestamp`<br>`$dueDate: Timestamp`<br>`$hub: String`<br>`$managerName: String`<br>`$vendorNumber: String`<br>`$roles: Any`<br>`$charges: Any`<br>`$otherCharges: Float`<br>`$subtotal: Float`<br>`$amount: Float`<br>`$notes: String`<br>`$staffCount: Int`<br>`$chargesCount: Int` | `invoiceTemplate_update` |
| `deleteInvoiceTemplate` | Delete invoice template | `$id: UUID!` | `invoiceTemplate_delete` |

## level

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listLevels` | List levels | — | `levels` |
| `getLevelById` | Get level by id | `$id: UUID!` | `level` |
| `filterLevels` | Filter levels | `$name: String`<br>`$xpRequired: Int` | `levels` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createLevel` | Create level | `$name: String!`<br>`$xpRequired: Int!`<br>`$icon: String`<br>`$colors: Any` | `level_insert` |
| `updateLevel` | Update level | `$id: UUID!`<br>`$name: String`<br>`$xpRequired: Int`<br>`$icon: String`<br>`$colors: Any` | `level_update` |
| `deleteLevel` | Delete level | `$id: UUID!` | `level_delete` |

## memberTask

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `getMyTasks` | Get my tasks | `$teamMemberId: UUID!` | `memberTasks` |
| `getMemberTaskByIdKey` | Get member task by id key | `$teamMemberId: UUID!`<br>`$taskId: UUID!` | `memberTask` |
| `getMemberTasksByTaskId` | Get member tasks by task id | `$taskId: UUID!` | `memberTasks` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createMemberTask` | Create member task | `$teamMemberId: UUID!`<br>`$taskId: UUID!` | `memberTask_insert` |
| `deleteMemberTask` | Delete member task | `$teamMemberId: UUID!`<br>`$taskId: UUID!` | `memberTask_delete` |

## message

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listMessages` | List messages | — | `messages` |
| `getMessageById` | Get message by id | `$id: UUID!` | `message` |
| `getMessagesByConversationId` | Get messages by conversation id | `$conversationId: UUID!` | `messages` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createMessage` | Create message | `$conversationId: UUID!`<br>`$senderId: String!`<br>`$content: String!`<br>`$isSystem: Boolean` | `message_insert` |
| `updateMessage` | Update message | `$id: UUID!`<br>`$conversationId: UUID`<br>`$senderId: String`<br>`$content: String`<br>`$isSystem: Boolean` | `message_update` |
| `deleteMessage` | Delete message | `$id: UUID!` | `message_delete` |

## order

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listOrders` | List orders | `$offset: Int`<br>`$limit: Int` | `orders` |
| `getOrderById` | Get order by id | `$id: UUID!` | `order` |
| `getOrdersByBusinessId` | Get orders by business id | `$businessId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `orders` |
| `getOrdersByVendorId` | Get orders by vendor id | `$vendorId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `orders` |
| `getOrdersByStatus` | Get orders by status | `$status: OrderStatus!`<br>`$offset: Int`<br>`$limit: Int` | `orders` |
| `getOrdersByDateRange` | Get orders by date range | `$start: Timestamp!`<br>`$end: Timestamp!`<br>`$offset: Int`<br>`$limit: Int` | `orders` |
| `getRapidOrders` | Get rapid orders | `$offset: Int`<br>`$limit: Int` | `orders` |
| `listOrdersByBusinessAndTeamHub` | List orders by business and team hub | `$businessId: UUID!`<br>`$teamHubId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `orders` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createOrder` | Create order | `$vendorId: UUID`<br>`$businessId: UUID!`<br>`$orderType: OrderType!`<br>`$status: OrderStatus`<br>`$date: Timestamp`<br>`$startDate: Timestamp`<br>`$endDate: Timestamp`<br>`$duration: OrderDuration`<br>`$lunchBreak: Int`<br>`$total: Float`<br>`$eventName: String`<br>`$assignedStaff: Any`<br>`$shifts: Any`<br>`$requested: Int`<br>`$teamHubId: UUID!`<br>`$recurringDays: Any`<br>`$permanentStartDate: Timestamp`<br>`$permanentDays: Any`<br>`$notes: String`<br>`$detectedConflicts: Any`<br>`$poReference: String` | `order_insert` |
| `updateOrder` | Update order | `$id: UUID!`<br>`$vendorId: UUID`<br>`$businessId: UUID`<br>`$status: OrderStatus`<br>`$date: Timestamp`<br>`$startDate: Timestamp`<br>`$endDate: Timestamp`<br>`$total: Float`<br>`$eventName: String`<br>`$assignedStaff: Any`<br>`$shifts: Any`<br>`$requested: Int`<br>`$teamHubId: UUID!`<br>`$recurringDays: Any`<br>`$permanentDays: Any`<br>`$notes: String`<br>`$detectedConflicts: Any`<br>`$poReference: String` | `order_update` |
| `deleteOrder` | Delete order | `$id: UUID!` | `order_delete` |

## recentPayment

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listRecentPayments` | List recent payments | `$offset: Int`<br>`$limit: Int` | `recentPayments` |
| `getRecentPaymentById` | Get recent payment by id | `$id: UUID!` | `recentPayment` |
| `listRecentPaymentsByStaffId` | List recent payments by staff id | `$staffId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `recentPayments` |
| `listRecentPaymentsByApplicationId` | List recent payments by application id | `$applicationId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `recentPayments` |
| `listRecentPaymentsByInvoiceId` | List recent payments by invoice id | `$invoiceId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `recentPayments` |
| `listRecentPaymentsByStatus` | List recent payments by status | `$status: RecentPaymentStatus!`<br>`$offset: Int`<br>`$limit: Int` | `recentPayments` |
| `listRecentPaymentsByInvoiceIds` | List recent payments by invoice ids | `$invoiceIds: [UUID!]!`<br>`$offset: Int`<br>`$limit: Int` | `recentPayments` |
| `listRecentPaymentsByBusinessId` | List recent payments by business id | `$businessId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `recentPayments` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createRecentPayment` | Create recent payment | `$workedTime: String`<br>`$status: RecentPaymentStatus`<br>`$staffId: UUID!`<br>`$applicationId: UUID!`<br>`$invoiceId: UUID!` | `recentPayment_insert` |
| `updateRecentPayment` | Update recent payment | `$id: UUID!`<br>`$workedTime: String`<br>`$status: RecentPaymentStatus`<br>`$staffId: UUID`<br>`$applicationId: UUID`<br>`$invoiceId: UUID` | `recentPayment_update` |
| `deleteRecentPayment` | Delete recent payment | `$id: UUID!` | `recentPayment_delete` |

## reports

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listShiftsForCoverage` | List shifts for coverage | `$businessId: UUID!`<br>`$startDate: Timestamp!`<br>`$endDate: Timestamp!` | `shifts` |
| `listApplicationsForCoverage` | List applications for coverage | `$shiftIds: [UUID!]!` | `applications` |
| `listShiftsForDailyOpsByBusiness` | List shifts for daily ops by business | `$businessId: UUID!`<br>`$date: Timestamp!` | `shifts` |
| `listShiftsForDailyOpsByVendor` | List shifts for daily ops by vendor | `$vendorId: UUID!`<br>`$date: Timestamp!` | `shifts` |
| `listApplicationsForDailyOps` | List applications for daily ops | `$shiftIds: [UUID!]!` | `applications` |
| `listShiftsForForecastByBusiness` | List shifts for forecast by business | `$businessId: UUID!`<br>`$startDate: Timestamp!`<br>`$endDate: Timestamp!` | `shifts` |
| `listShiftsForForecastByVendor` | List shifts for forecast by vendor | `$vendorId: UUID!`<br>`$startDate: Timestamp!`<br>`$endDate: Timestamp!` | `shifts` |
| `listShiftsForNoShowRangeByBusiness` | List shifts for no show range by business | `$businessId: UUID!`<br>`$startDate: Timestamp!`<br>`$endDate: Timestamp!` | `shifts` |
| `listShiftsForNoShowRangeByVendor` | List shifts for no show range by vendor | `$vendorId: UUID!`<br>`$startDate: Timestamp!`<br>`$endDate: Timestamp!` | `shifts` |
| `listApplicationsForNoShowRange` | List applications for no show range | `$shiftIds: [UUID!]!` | `applications` |
| `listStaffForNoShowReport` | List staff for no show report | `$staffIds: [UUID!]!` | `staffs` |
| `listInvoicesForSpendByBusiness` | List invoices for spend by business | `$businessId: UUID!`<br>`$startDate: Timestamp!`<br>`$endDate: Timestamp!` | `invoices` |
| `listInvoicesForSpendByVendor` | List invoices for spend by vendor | `$vendorId: UUID!`<br>`$startDate: Timestamp!`<br>`$endDate: Timestamp!` | `invoices` |
| `listInvoicesForSpendByOrder` | List invoices for spend by order | `$orderId: UUID!`<br>`$startDate: Timestamp!`<br>`$endDate: Timestamp!` | `invoices` |
| `listTimesheetsForSpend` | List timesheets for spend | `$startTime: Timestamp!`<br>`$endTime: Timestamp!` | `shiftRoles` |
| `listShiftsForPerformanceByBusiness` | List shifts for performance by business | `$businessId: UUID!`<br>`$startDate: Timestamp!`<br>`$endDate: Timestamp!` | `shifts` |
| `listShiftsForPerformanceByVendor` | List shifts for performance by vendor | `$vendorId: UUID!`<br>`$startDate: Timestamp!`<br>`$endDate: Timestamp!` | `shifts` |
| `listApplicationsForPerformance` | List applications for performance | `$shiftIds: [UUID!]!` | `applications` |
| `listStaffForPerformance` | List staff for performance | `$staffIds: [UUID!]!` | `staffs` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| — | — | — | — |

Notes: Used by Reports.

## role

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listRoles` | List roles | — | `roles` |
| `getRoleById` | Get role by id | `$id: UUID!` | `role` |
| `listRolesByVendorId` | List roles by vendor id | `$vendorId: UUID!` | `roles` |
| `listRolesByroleCategoryId` | List roles byrole category id | `$roleCategoryId: UUID!` | `roles` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createRole` | Create role | `$name: String!`<br>`$costPerHour: Float!`<br>`$vendorId: UUID!`<br>`$roleCategoryId: UUID!` | `role_insert` |
| `updateRole` | Update role | `$id: UUID!`<br>`$name: String`<br>`$costPerHour: Float`<br>`$roleCategoryId: UUID!` | `role_update` |
| `deleteRole` | Delete role | `$id: UUID!` | `role_delete` |

## roleCategory

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listRoleCategories` | List role categories | — | `roleCategories` |
| `getRoleCategoryById` | Get role category by id | `$id: UUID!` | `roleCategory` |
| `getRoleCategoriesByCategory` | Get role categories by category | `$category: RoleCategoryType!` | `roleCategories` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createRoleCategory` | Create role category | `$roleName: String!`<br>`$category: RoleCategoryType!` | `roleCategory_insert` |
| `updateRoleCategory` | Update role category | `$id: UUID!`<br>`$roleName: String`<br>`$category: RoleCategoryType` | `roleCategory_update` |
| `deleteRoleCategory` | Delete role category | `$id: UUID!` | `roleCategory_delete` |

## shift

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listShifts` | List shifts | `$offset: Int`<br>`$limit: Int` | `shifts` |
| `getShiftById` | Get shift by id | `$id: UUID!` | `shift` |
| `filterShifts` | Filter shifts | `$status: ShiftStatus`<br>`$orderId: UUID`<br>`$dateFrom: Timestamp`<br>`$dateTo: Timestamp`<br>`$offset: Int`<br>`$limit: Int` | `shifts` |
| `getShiftsByBusinessId` | Get shifts by business id | `$businessId: UUID!`<br>`$dateFrom: Timestamp`<br>`$dateTo: Timestamp`<br>`$offset: Int`<br>`$limit: Int` | `shifts` |
| `getShiftsByVendorId` | Get shifts by vendor id | `$vendorId: UUID!`<br>`$dateFrom: Timestamp`<br>`$dateTo: Timestamp`<br>`$offset: Int`<br>`$limit: Int` | `shifts` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createShift` | Create shift | `$title: String!`<br>`$orderId: UUID!`<br>`$date: Timestamp`<br>`$startTime: Timestamp`<br>`$endTime: Timestamp`<br>`$hours: Float`<br>`$cost: Float`<br>`$location: String`<br>`$locationAddress: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$placeId: String`<br>`$city: String`<br>`$state: String`<br>`$street: String`<br>`$country: String`<br>`$description: String`<br>`$status: ShiftStatus`<br>`$workersNeeded: Int`<br>`$filled: Int`<br>`$filledAt: Timestamp`<br>`$managers: [Any!]`<br>`$durationDays: Int`<br>`$createdBy: String` | `shift_insert` |
| `updateShift` | Update shift | `$id: UUID!`<br>`$title: String`<br>`$orderId: UUID`<br>`$date: Timestamp`<br>`$startTime: Timestamp`<br>`$endTime: Timestamp`<br>`$hours: Float`<br>`$cost: Float`<br>`$location: String`<br>`$locationAddress: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$placeId: String`<br>`$city: String`<br>`$state: String`<br>`$street: String`<br>`$country: String`<br>`$description: String`<br>`$status: ShiftStatus`<br>`$workersNeeded: Int`<br>`$filled: Int`<br>`$filledAt: Timestamp`<br>`$managers: [Any!]`<br>`$durationDays: Int` | `shift_update` |
| `deleteShift` | Delete shift | `$id: UUID!` | `shift_delete` |

## shiftRole

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `getShiftRoleById` | Get shift role by id | `$shiftId: UUID!`<br>`$roleId: UUID!` | `shiftRole` |
| `listShiftRolesByShiftId` | List shift roles by shift id | `$shiftId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `shiftRoles` |
| `listShiftRolesByRoleId` | List shift roles by role id | `$roleId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `shiftRoles` |
| `listShiftRolesByShiftIdAndTimeRange` | List shift roles by shift id and time range | `$shiftId: UUID!`<br>`$start: Timestamp!`<br>`$end: Timestamp!`<br>`$offset: Int`<br>`$limit: Int` | `shiftRoles` |
| `listShiftRolesByVendorId` | List shift roles by vendor id | `$vendorId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `shiftRoles` |
| `listShiftRolesByBusinessAndDateRange` | List shift roles by business and date range | `$businessId: UUID!`<br>`$start: Timestamp!`<br>`$end: Timestamp!`<br>`$offset: Int`<br>`$limit: Int`<br>`$status: ShiftStatus` | `shiftRoles` |
| `listShiftRolesByBusinessAndOrder` | List shift roles by business and order | `$businessId: UUID!`<br>`$orderId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `shiftRoles` |
| `listShiftRolesByBusinessDateRangeCompletedOrders` | List shift roles by business date range completed orders | `$businessId: UUID!`<br>`$start: Timestamp!`<br>`$end: Timestamp!`<br>`$offset: Int`<br>`$limit: Int` | `shiftRoles` |
| `listShiftRolesByBusinessAndDatesSummary` | List shift roles by business and dates summary | `$businessId: UUID!`<br>`$start: Timestamp!`<br>`$end: Timestamp!`<br>`$offset: Int`<br>`$limit: Int` | `shiftRoles` |
| `getCompletedShiftsByBusinessId` | Get completed shifts by business id | `$businessId: UUID!`<br>`$dateFrom: Timestamp!`<br>`$dateTo: Timestamp!`<br>`$offset: Int`<br>`$limit: Int` | `shifts` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createShiftRole` | Create shift role | `$shiftId: UUID!`<br>`$roleId: UUID!`<br>`$count: Int!`<br>`$assigned: Int`<br>`$startTime: Timestamp`<br>`$endTime: Timestamp`<br>`$hours: Float`<br>`$department: String`<br>`$uniform: String`<br>`$breakType: BreakDuration`<br>`$isBreakPaid: Boolean`<br>`$totalValue: Float` | `shiftRole_insert` |
| `updateShiftRole` | Update shift role | `$shiftId: UUID!`<br>`$roleId: UUID!`<br>`$count: Int`<br>`$assigned: Int`<br>`$startTime: Timestamp`<br>`$endTime: Timestamp`<br>`$hours: Float`<br>`$department: String`<br>`$uniform: String`<br>`$breakType: BreakDuration`<br>`$isBreakPaid: Boolean`<br>`$totalValue: Float` | `shiftRole_update` |
| `deleteShiftRole` | Delete shift role | `$shiftId: UUID!`<br>`$roleId: UUID!` | `shiftRole_delete` |

## staff

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listStaff` | List staff | — | `staffs` |
| `getStaffById` | Get staff by id | `$id: UUID!` | `staff` |
| `getStaffByUserId` | Get staff by user id | `$userId: String!` | `staffs` |
| `filterStaff` | Filter staff | `$ownerId: UUID`<br>`$fullName: String`<br>`$level: String`<br>`$email: String` | `staffs` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `CreateStaff` | Create staff | `$userId: String!`<br>`$fullName: String!`<br>`$level: String`<br>`$role: String`<br>`$phone: String`<br>`$email: String`<br>`$photoUrl: String`<br>`$totalShifts: Int`<br>`$averageRating: Float`<br>`$onTimeRate: Int`<br>`$noShowCount: Int`<br>`$cancellationCount: Int`<br>`$reliabilityScore: Int`<br>`$bio: String`<br>`$skills: [String!]`<br>`$industries: [String!]`<br>`$preferredLocations: [String!]`<br>`$maxDistanceMiles: Int`<br>`$languages: Any`<br>`$itemsAttire: Any`<br>`$xp: Int`<br>`$badges: Any`<br>`$isRecommended: Boolean`<br>`$ownerId: UUID`<br>`$department: DepartmentType`<br>`$hubId: UUID`<br>`$manager: UUID`<br>`$english: EnglishProficiency`<br>`$backgroundCheckStatus: BackgroundCheckStatus`<br>`$employmentType: EmploymentType`<br>`$initial: String`<br>`$englishRequired: Boolean`<br>`$city: String`<br>`$addres: String`<br>`$placeId: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$state: String`<br>`$street: String`<br>`$country: String`<br>`$zipCode: String` | `staff_insert` |
| `UpdateStaff` | Update staff | `$id: UUID!`<br>`$userId: String`<br>`$fullName: String`<br>`$level: String`<br>`$role: String`<br>`$phone: String`<br>`$email: String`<br>`$photoUrl: String`<br>`$totalShifts: Int`<br>`$averageRating: Float`<br>`$onTimeRate: Int`<br>`$noShowCount: Int`<br>`$cancellationCount: Int`<br>`$reliabilityScore: Int`<br>`$bio: String`<br>`$skills: [String!]`<br>`$industries: [String!]`<br>`$preferredLocations: [String!]`<br>`$maxDistanceMiles: Int`<br>`$languages: Any`<br>`$itemsAttire: Any`<br>`$xp: Int`<br>`$badges: Any`<br>`$isRecommended: Boolean`<br>`$ownerId: UUID`<br>`$department: DepartmentType`<br>`$hubId: UUID`<br>`$manager: UUID`<br>`$english: EnglishProficiency`<br>`$backgroundCheckStatus: BackgroundCheckStatus`<br>`$employmentType: EmploymentType`<br>`$initial: String`<br>`$englishRequired: Boolean`<br>`$city: String`<br>`$addres: String`<br>`$placeId: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$state: String`<br>`$street: String`<br>`$country: String`<br>`$zipCode: String` | `staff_update` |
| `DeleteStaff` | Delete staff | `$id: UUID!` | `staff_delete` |

## staffAvailability

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listStaffAvailabilities` | List staff availabilities | `$offset: Int`<br>`$limit: Int` | `staffAvailabilities` |
| `listStaffAvailabilitiesByStaffId` | List staff availabilities by staff id | `$staffId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `staffAvailabilities` |
| `getStaffAvailabilityByKey` | Get staff availability by key | `$staffId: UUID!`<br>`$day: DayOfWeek!`<br>`$slot: AvailabilitySlot!` | `staffAvailability` |
| `listStaffAvailabilitiesByDay` | List staff availabilities by day | `$day: DayOfWeek!`<br>`$offset: Int`<br>`$limit: Int` | `staffAvailabilities` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createStaffAvailability` | Create staff availability | `$staffId: UUID!`<br>`$day: DayOfWeek!`<br>`$slot: AvailabilitySlot!`<br>`$status: AvailabilityStatus`<br>`$notes: String` | `staffAvailability_insert` |
| `updateStaffAvailability` | Update staff availability | `$staffId: UUID!`<br>`$day: DayOfWeek!`<br>`$slot: AvailabilitySlot!`<br>`$status: AvailabilityStatus`<br>`$notes: String` | `staffAvailability_update` |
| `deleteStaffAvailability` | Delete staff availability | `$staffId: UUID!`<br>`$day: DayOfWeek!`<br>`$slot: AvailabilitySlot!` | `staffAvailability_delete` |

## staffAvailabilityStats

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listStaffAvailabilityStats` | List staff availability stats | `$offset: Int`<br>`$limit: Int` | `staffAvailabilityStatss` |
| `getStaffAvailabilityStatsByStaffId` | Get staff availability stats by staff id | `$staffId: UUID!` | `staffAvailabilityStats` |
| `filterStaffAvailabilityStats` | Filter staff availability stats | `$needWorkIndexMin: Int`<br>`$needWorkIndexMax: Int`<br>`$utilizationMin: Int`<br>`$utilizationMax: Int`<br>`$acceptanceRateMin: Int`<br>`$acceptanceRateMax: Int`<br>`$lastShiftAfter: Timestamp`<br>`$lastShiftBefore: Timestamp`<br>`$offset: Int`<br>`$limit: Int` | `staffAvailabilityStatss` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createStaffAvailabilityStats` | Create staff availability stats | `$staffId: UUID!`<br>`$needWorkIndex: Int`<br>`$utilizationPercentage: Int`<br>`$predictedAvailabilityScore: Int`<br>`$scheduledHoursThisPeriod: Int`<br>`$desiredHoursThisPeriod: Int`<br>`$lastShiftDate: Timestamp`<br>`$acceptanceRate: Int` | `staffAvailabilityStats_insert` |
| `updateStaffAvailabilityStats` | Update staff availability stats | `$staffId: UUID!`<br>`$needWorkIndex: Int`<br>`$utilizationPercentage: Int`<br>`$predictedAvailabilityScore: Int`<br>`$scheduledHoursThisPeriod: Int`<br>`$desiredHoursThisPeriod: Int`<br>`$lastShiftDate: Timestamp`<br>`$acceptanceRate: Int` | `staffAvailabilityStats_update` |
| `deleteStaffAvailabilityStats` | Delete staff availability stats | `$staffId: UUID!` | `staffAvailabilityStats_delete` |

## staffCourse

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `getStaffCourseById` | Get staff course by id | `$id: UUID!` | `staffCourse` |
| `listStaffCoursesByStaffId` | List staff courses by staff id | `$staffId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `staffCourses` |
| `listStaffCoursesByCourseId` | List staff courses by course id | `$courseId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `staffCourses` |
| `getStaffCourseByStaffAndCourse` | Get staff course by staff and course | `$staffId: UUID!`<br>`$courseId: UUID!` | `staffCourses` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createStaffCourse` | Create staff course | `$staffId: UUID!`<br>`$courseId: UUID!`<br>`$progressPercent: Int`<br>`$completed: Boolean`<br>`$completedAt: Timestamp`<br>`$startedAt: Timestamp`<br>`$lastAccessedAt: Timestamp` | `staffCourse_insert` |
| `updateStaffCourse` | Update staff course | `$id: UUID!`<br>`$progressPercent: Int`<br>`$completed: Boolean`<br>`$completedAt: Timestamp`<br>`$startedAt: Timestamp`<br>`$lastAccessedAt: Timestamp` | `staffCourse_update` |
| `deleteStaffCourse` | Delete staff course | `$id: UUID!` | `staffCourse_delete` |

## staffDocument

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `getStaffDocumentByKey` | Get staff document by key | `$staffId: UUID!`<br>`$documentId: UUID!` | `staffDocument` |
| `listStaffDocumentsByStaffId` | List staff documents by staff id | `$staffId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `staffDocuments` |
| `listStaffDocumentsByDocumentType` | List staff documents by document type | `$documentType: DocumentType!`<br>`$offset: Int`<br>`$limit: Int` | `staffDocuments` |
| `listStaffDocumentsByStatus` | List staff documents by status | `$status: DocumentStatus!`<br>`$offset: Int`<br>`$limit: Int` | `staffDocuments` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createStaffDocument` | Create staff document | `$staffId: UUID!`<br>`$staffName: String!`<br>`$documentId: UUID!`<br>`$status: DocumentStatus!`<br>`$documentUrl: String`<br>`$expiryDate: Timestamp` | `staffDocument_insert` |
| `updateStaffDocument` | Update staff document | `$staffId: UUID!`<br>`$documentId: UUID!`<br>`$status: DocumentStatus`<br>`$documentUrl: String`<br>`$expiryDate: Timestamp` | `staffDocument_update` |
| `deleteStaffDocument` | Delete staff document | `$staffId: UUID!`<br>`$documentId: UUID!` | `staffDocument_delete` |

## staffRole

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listStaffRoles` | List staff roles | `$offset: Int`<br>`$limit: Int` | `staffRoles` |
| `getStaffRoleByKey` | Get staff role by key | `$staffId: UUID!`<br>`$roleId: UUID!` | `staffRole` |
| `listStaffRolesByStaffId` | List staff roles by staff id | `$staffId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `staffRoles` |
| `listStaffRolesByRoleId` | List staff roles by role id | `$roleId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `staffRoles` |
| `filterStaffRoles` | Filter staff roles | `$staffId: UUID`<br>`$roleId: UUID`<br>`$offset: Int`<br>`$limit: Int` | `staffRoles` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createStaffRole` | Create staff role | `$staffId: UUID!`<br>`$roleId: UUID!`<br>`$roleType: RoleType` | `staffRole_insert` |
| `deleteStaffRole` | Delete staff role | `$staffId: UUID!`<br>`$roleId: UUID!` | `staffRole_delete` |

## task

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listTasks` | List tasks | — | `tasks` |
| `getTaskById` | Get task by id | `$id: UUID!` | `task` |
| `getTasksByOwnerId` | Get tasks by owner id | `$ownerId: UUID!` | `tasks` |
| `filterTasks` | Filter tasks | `$status: TaskStatus`<br>`$priority: TaskPriority` | `tasks` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createTask` | Create task | `$taskName: String!`<br>`$description: String`<br>`$priority: TaskPriority!`<br>`$status: TaskStatus!`<br>`$dueDate: Timestamp`<br>`$progress: Int`<br>`$orderIndex: Int`<br>`$commentCount: Int`<br>`$attachmentCount: Int`<br>`$files: Any`<br>`$ownerId:UUID!` | `task_insert` |
| `updateTask` | Update task | `$id: UUID!`<br>`$taskName: String`<br>`$description: String`<br>`$priority: TaskPriority`<br>`$status: TaskStatus`<br>`$dueDate: Timestamp`<br>`$progress: Int`<br>`$assignedMembers: Any`<br>`$orderIndex: Int`<br>`$commentCount: Int`<br>`$attachmentCount: Int`<br>`$files: Any` | `task_update` |
| `deleteTask` | Delete task | `$id: UUID!` | `task_delete` |

## task_comment

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listTaskComments` | List task comments | — | `taskComments` |
| `getTaskCommentById` | Get task comment by id | `$id: UUID!` | `taskComment` |
| `getTaskCommentsByTaskId` | Get task comments by task id | `$taskId: UUID!` | `taskComments` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createTaskComment` | Create task comment | `$taskId: UUID!`<br>`$teamMemberId: UUID!`<br>`$comment: String!`<br>`$isSystem: Boolean` | `taskComment_insert` |
| `updateTaskComment` | Update task comment | `$id: UUID!`<br>`$comment: String`<br>`$isSystem: Boolean` | `taskComment_update` |
| `deleteTaskComment` | Delete task comment | `$id: UUID!` | `taskComment_delete` |

## taxForm

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listTaxForms` | List tax forms | `$offset: Int`<br>`$limit: Int` | `taxForms` |
| `getTaxFormById` | Get tax form by id | `$id: UUID!` | `taxForm` |
| `getTaxFormsByStaffId` | Get tax forms by staff id | `$staffId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `taxForms` |
| `listTaxFormsWhere` | List tax forms where | `$formType: TaxFormType`<br>`$status: TaxFormStatus`<br>`$staffId: UUID`<br>`$offset: Int`<br>`$limit: Int` | `taxForms` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createTaxForm` | Create tax form | `$formType: TaxFormType!`<br>`$firstName: String!`<br>`$lastName: String!`<br>`$mInitial: String`<br>`$oLastName: String`<br>`$dob: Timestamp`<br>`$socialSN: Int!`<br>`$email: String`<br>`$phone: String`<br>`$address: String!`<br>`$placeId: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$city: String`<br>`$apt: String`<br>`$state: String`<br>`$street: String`<br>`$country: String`<br>`$zipCode: String`<br>`$marital: MaritalStatus`<br>`$multipleJob: Boolean`<br>`$childrens: Int`<br>`$otherDeps: Int`<br>`$totalCredits: Float`<br>`$otherInconme: Float`<br>`$deductions: Float`<br>`$extraWithholding: Float`<br>`$citizen: CitizenshipStatus`<br>`$uscis: String`<br>`$passportNumber: String`<br>`$countryIssue: String`<br>`$prepartorOrTranslator: Boolean`<br>`$signature: String`<br>`$date: Timestamp`<br>`$status: TaxFormStatus!`<br>`$staffId: UUID!`<br>`$createdBy: String` | `taxForm_insert` |
| `updateTaxForm` | Update tax form | `$id: UUID!`<br>`$formType: TaxFormType`<br>`$firstName: String`<br>`$lastName: String`<br>`$mInitial: String`<br>`$oLastName: String`<br>`$dob: Timestamp`<br>`$socialSN: Int`<br>`$email: String`<br>`$phone: String`<br>`$address: String`<br>`$placeId: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$city: String`<br>`$apt: String`<br>`$state: String`<br>`$street: String`<br>`$country: String`<br>`$zipCode: String`<br>`$marital: MaritalStatus`<br>`$multipleJob: Boolean`<br>`$childrens: Int`<br>`$otherDeps: Int`<br>`$totalCredits: Float`<br>`$otherInconme: Float`<br>`$deductions: Float`<br>`$extraWithholding: Float`<br>`$citizen: CitizenshipStatus`<br>`$uscis: String`<br>`$passportNumber: String`<br>`$countryIssue: String`<br>`$prepartorOrTranslator: Boolean`<br>`$signature: String`<br>`$date: Timestamp`<br>`$status: TaxFormStatus` | `taxForm_update` |
| `deleteTaxForm` | Delete tax form | `$id: UUID!` | `taxForm_delete` |

## team

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listTeams` | List teams | — | `teams` |
| `getTeamById` | Get team by id | `$id: UUID!` | `team` |
| `getTeamsByOwnerId` | Get teams by owner id | `$ownerId: UUID!` | `teams` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createTeam` | Create team | `$teamName: String!`<br>`$ownerId: UUID!`<br>`$ownerName: String!`<br>`$ownerRole: String!`<br>`$email: String`<br>`$companyLogo: String`<br>`$totalMembers: Int`<br>`$activeMembers: Int`<br>`$totalHubs: Int`<br>`$departments: Any`<br>`$favoriteStaffCount: Int`<br>`$blockedStaffCount: Int`<br>`$favoriteStaff: Any`<br>`$blockedStaff: Any` | `team_insert` |
| `updateTeam` | Update team | `$id: UUID!`<br>`$teamName: String`<br>`$ownerName: String`<br>`$ownerRole: String`<br>`$companyLogo: String`<br>`$totalMembers: Int`<br>`$activeMembers: Int`<br>`$totalHubs: Int`<br>`$departments: Any`<br>`$favoriteStaffCount: Int`<br>`$blockedStaffCount: Int`<br>`$favoriteStaff: Any`<br>`$blockedStaff: Any` | `team_update` |
| `deleteTeam` | Delete team | `$id: UUID!` | `team_delete` |

## teamHub

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listTeamHubs` | List team hubs | `$offset: Int`<br>`$limit: Int` | `teamHubs` |
| `getTeamHubById` | Get team hub by id | `$id: UUID!` | `teamHub` |
| `getTeamHubsByTeamId` | Get team hubs by team id | `$teamId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `teamHubs` |
| `listTeamHubsByOwnerId` | List team hubs by owner id | `$ownerId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `teamHubs` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createTeamHub` | Create team hub | `$teamId: UUID!`<br>`$hubName: String!`<br>`$address: String!`<br>`$placeId: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$city: String`<br>`$state: String`<br>`$street: String`<br>`$country: String`<br>`$zipCode: String`<br>`$managerName: String`<br>`$isActive: Boolean`<br>`$departments: Any` | `teamHub_insert` |
| `updateTeamHub` | Update team hub | `$id: UUID!`<br>`$teamId: UUID`<br>`$hubName: String`<br>`$address: String`<br>`$placeId: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$city: String`<br>`$state: String`<br>`$street: String`<br>`$country: String`<br>`$zipCode: String`<br>`$managerName: String`<br>`$isActive: Boolean`<br>`$departments: Any` | `teamHub_update` |
| `deleteTeamHub` | Delete team hub | `$id: UUID!` | `teamHub_delete` |

## teamHudDeparment

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listTeamHudDepartments` | List team hud departments | `$offset: Int`<br>`$limit: Int` | `teamHudDepartments` |
| `getTeamHudDepartmentById` | Get team hud department by id | `$id: UUID!` | `teamHudDepartment` |
| `listTeamHudDepartmentsByTeamHubId` | List team hud departments by team hub id | `$teamHubId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `teamHudDepartments` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createTeamHudDepartment` | Create team hud department | `$name: String!`<br>`$costCenter: String`<br>`$teamHubId: UUID!` | `teamHudDepartment_insert` |
| `updateTeamHudDepartment` | Update team hud department | `$id: UUID!`<br>`$name: String`<br>`$costCenter: String`<br>`$teamHubId: UUID` | `teamHudDepartment_update` |
| `deleteTeamHudDepartment` | Delete team hud department | `$id: UUID!` | `teamHudDepartment_delete` |

## teamMember

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listTeamMembers` | List team members | — | `teamMembers` |
| `getTeamMemberById` | Get team member by id | `$id: UUID!` | `teamMember` |
| `getTeamMembersByTeamId` | Get team members by team id | `$teamId: UUID!` | `teamMembers` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createTeamMember` | Create team member | `$teamId: UUID!`<br>`$role: TeamMemberRole!`<br>`$title: String`<br>`$department: String`<br>`$teamHubId: UUID`<br>`$isActive: Boolean`<br>`$userId: String!`<br>`$inviteStatus: TeamMemberInviteStatus` | `teamMember_insert` |
| `updateTeamMember` | Update team member | `$id: UUID!`<br>`$role: TeamMemberRole`<br>`$title: String`<br>`$department: String`<br>`$teamHubId: UUID`<br>`$isActive: Boolean`<br>`$inviteStatus: TeamMemberInviteStatus` | `teamMember_update` |
| `updateTeamMemberInviteStatus` | Update team member invite status | `$id: UUID!`<br>`$inviteStatus: TeamMemberInviteStatus!` | `teamMember_update` |
| `acceptInviteByCode` | Accept invite by code | `$inviteCode: UUID!` | `teamMember_updateMany` |
| `cancelInviteByCode` | Cancel invite by code | `$inviteCode: UUID!` | `teamMember_updateMany` |
| `deleteTeamMember` | Delete team member | `$id: UUID!` | `teamMember_delete` |

## user

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listUsers` | List users | — | `users` |
| `getUserById` | Get user by id | `$id: String!` | `user` |
| `filterUsers` | Filter users | `$id: String`<br>`$email: String`<br>`$role: UserBaseRole`<br>`$userRole: String` | `users` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `CreateUser` | Create user | `$id: String!`<br>`$email: String`<br>`$fullName: String`<br>`$role: UserBaseRole!`<br>`$userRole: String`<br>`$photoUrl: String` | `user_insert` |
| `UpdateUser` | Update user | `$id: String!`<br>`$email: String`<br>`$fullName: String`<br>`$role: UserBaseRole`<br>`$userRole: String`<br>`$photoUrl: String` | `user_update` |
| `DeleteUser` | Delete user | `$id: String!` | `user_delete` |

## userConversation

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listUserConversations` | List user conversations | `$offset: Int`<br>`$limit: Int` | `userConversations` |
| `getUserConversationByKey` | Get user conversation by key | `$conversationId: UUID!`<br>`$userId: String!` | `userConversation` |
| `listUserConversationsByUserId` | List user conversations by user id | `$userId: String!`<br>`$offset: Int`<br>`$limit: Int` | `userConversations` |
| `listUnreadUserConversationsByUserId` | List unread user conversations by user id | `$userId: String!`<br>`$offset: Int`<br>`$limit: Int` | `userConversations` |
| `listUserConversationsByConversationId` | List user conversations by conversation id | `$conversationId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `userConversations` |
| `filterUserConversations` | Filter user conversations | `$userId: String`<br>`$conversationId: UUID`<br>`$unreadMin: Int`<br>`$unreadMax: Int`<br>`$lastReadAfter: Timestamp`<br>`$lastReadBefore: Timestamp`<br>`$offset: Int`<br>`$limit: Int` | `userConversations` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createUserConversation` | Create user conversation | `$conversationId: UUID!`<br>`$userId: String!`<br>`$unreadCount: Int`<br>`$lastReadAt: Timestamp` | `userConversation_insert` |
| `updateUserConversation` | Update user conversation | `$conversationId: UUID!`<br>`$userId: String!`<br>`$unreadCount: Int`<br>`$lastReadAt: Timestamp` | `userConversation_update` |
| `markConversationAsRead` | Mark conversation as read | `$conversationId: UUID!`<br>`$userId: String!`<br>`$lastReadAt: Timestamp` | `userConversation_update` |
| `incrementUnreadForUser` | Increment unread for user | `$conversationId: UUID!`<br>`$userId: String!`<br>`$unreadCount: Int!` | `userConversation_update` |
| `deleteUserConversation` | Delete user conversation | `$conversationId: UUID!`<br>`$userId: String!` | `userConversation_delete` |

## vendor

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `getVendorById` | Get vendor by id | `$id: UUID!` | `vendor` |
| `getVendorByUserId` | Get vendor by user id | `$userId: String!` | `vendors` |
| `listVendors` | List vendors | — | `vendors` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createVendor` | Create vendor | `$userId: String!`<br>`$companyName: String!`<br>`$email: String`<br>`$phone: String`<br>`$photoUrl: String`<br>`$address: String`<br>`$placeId: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$street: String`<br>`$country: String`<br>`$zipCode: String`<br>`$billingAddress: String`<br>`$timezone: String`<br>`$legalName: String`<br>`$doingBusinessAs: String`<br>`$region: String`<br>`$state: String`<br>`$city: String`<br>`$serviceSpecialty: String`<br>`$approvalStatus: ApprovalStatus`<br>`$isActive: Boolean`<br>`$markup: Float`<br>`$fee: Float`<br>`$csat: Float`<br>`$tier: VendorTier` | `vendor_insert` |
| `updateVendor` | Update vendor | `$id: UUID!`<br>`$companyName: String`<br>`$email: String`<br>`$phone: String`<br>`$photoUrl: String`<br>`$address: String`<br>`$placeId: String`<br>`$latitude: Float`<br>`$longitude: Float`<br>`$street: String`<br>`$country: String`<br>`$zipCode: String`<br>`$billingAddress: String`<br>`$timezone: String`<br>`$legalName: String`<br>`$doingBusinessAs: String`<br>`$region: String`<br>`$state: String`<br>`$city: String`<br>`$serviceSpecialty: String`<br>`$approvalStatus: ApprovalStatus`<br>`$isActive: Boolean`<br>`$markup: Float`<br>`$fee: Float`<br>`$csat: Float`<br>`$tier: VendorTier` | `vendor_update` |
| `deleteVendor` | Delete vendor | `$id: UUID!` | `vendor_delete` |

## vendorBenefitPlan

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listVendorBenefitPlans` | List vendor benefit plans | `$offset: Int`<br>`$limit: Int` | `vendorBenefitPlans` |
| `getVendorBenefitPlanById` | Get vendor benefit plan by id | `$id: UUID!` | `vendorBenefitPlan` |
| `listVendorBenefitPlansByVendorId` | List vendor benefit plans by vendor id | `$vendorId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `vendorBenefitPlans` |
| `listActiveVendorBenefitPlansByVendorId` | List active vendor benefit plans by vendor id | `$vendorId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `vendorBenefitPlans` |
| `filterVendorBenefitPlans` | Filter vendor benefit plans | `$vendorId: UUID`<br>`$title: String`<br>`$isActive: Boolean`<br>`$offset: Int`<br>`$limit: Int` | `vendorBenefitPlans` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createVendorBenefitPlan` | Create vendor benefit plan | `$vendorId: UUID!`<br>`$title: String!`<br>`$description: String`<br>`$requestLabel: String`<br>`$total: Int`<br>`$isActive: Boolean`<br>`$createdBy: String` | `vendorBenefitPlan_insert` |
| `updateVendorBenefitPlan` | Update vendor benefit plan | `$id: UUID!`<br>`$vendorId: UUID`<br>`$title: String`<br>`$description: String`<br>`$requestLabel: String`<br>`$total: Int`<br>`$isActive: Boolean`<br>`$createdBy: String` | `vendorBenefitPlan_update` |
| `deleteVendorBenefitPlan` | Delete vendor benefit plan | `$id: UUID!` | `vendorBenefitPlan_delete` |

## vendorRate

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `listVendorRates` | List vendor rates | — | `vendorRates` |
| `getVendorRateById` | Get vendor rate by id | `$id: UUID!` | `vendorRate` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createVendorRate` | Create vendor rate | `$vendorId: UUID!`<br>`$roleName: String`<br>`$category: CategoryType`<br>`$clientRate: Float`<br>`$employeeWage: Float`<br>`$markupPercentage: Float`<br>`$vendorFeePercentage: Float`<br>`$isActive: Boolean`<br>`$notes: String` | `vendorRate_insert` |
| `updateVendorRate` | Update vendor rate | `$id: UUID!`<br>`$vendorId: UUID`<br>`$roleName: String`<br>`$category: CategoryType`<br>`$clientRate: Float`<br>`$employeeWage: Float`<br>`$markupPercentage: Float`<br>`$vendorFeePercentage: Float`<br>`$isActive: Boolean`<br>`$notes: String` | `vendorRate_update` |
| `deleteVendorRate` | Delete vendor rate | `$id: UUID!` | `vendorRate_delete` |

## workForce

### Queries
| Name | Purpose | Parameters | Returns |
|------|---------|------------|---------|
| `getWorkforceById` | Get workforce by id | `$id: UUID!` | `workforce` |
| `getWorkforceByVendorAndStaff` | Get workforce by vendor and staff | `$vendorId: UUID!`<br>`$staffId: UUID!` | `workforces` |
| `listWorkforceByVendorId` | List workforce by vendor id | `$vendorId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `workforces` |
| `listWorkforceByStaffId` | List workforce by staff id | `$staffId: UUID!`<br>`$offset: Int`<br>`$limit: Int` | `workforces` |
| `getWorkforceByVendorAndNumber` | Get workforce by vendor and number | `$vendorId: UUID!`<br>`$workforceNumber: String!` | `workforces` |

### Mutations
| Name | Purpose | Parameters | Affects |
|------|---------|------------|---------|
| `createWorkforce` | Create workforce | `$vendorId: UUID!`<br>`$staffId: UUID!`<br>`$workforceNumber: String!`<br>`$employmentType: WorkforceEmploymentType` | `workforce_insert` |
| `updateWorkforce` | Update workforce | `$id: UUID!`<br>`$workforceNumber: String`<br>`$employmentType: WorkforceEmploymentType`<br>`$status: WorkforceStatus` | `workforce_update` |
| `deactivateWorkforce` | Deactivate workforce | `$id: UUID!` | `workforce_update` |
