
query getStaffDocumentByKey(
  $staffId: UUID!
  $documentId: UUID!
) @auth(level: USER) {
  staffDocument(key: { staffId: $staffId, documentId: $documentId }) {
    id
    staffId
    staffName
    documentId
    status
    documentUrl
    expiryDate
    createdAt
    updatedAt
    document {
      id
      name
      documentType
      description
    }
  }
}

query listStaffDocumentsByStaffId(
  $staffId: UUID!
  $offset: Int
  $limit: Int
) @auth(level: USER) {
  staffDocuments(
    where: { staffId: { eq: $staffId } }
    offset: $offset
    limit: $limit
  ) {
    id
    staffId
    staffName
    documentId
    status
    documentUrl
    expiryDate
    createdAt
    updatedAt
    document {
      id
      name
      documentType
    }
  }
}

query listStaffDocumentsByDocumentType(
  $documentType: DocumentType!
  $offset: Int
  $limit: Int
) @auth(level: USER) {
  staffDocuments(
    where: { document: { documentType: { eq: $documentType } } }
    offset: $offset
    limit: $limit
  ) {
    id
    staffId
    staffName
    documentId
    status
    documentUrl
    expiryDate
    document {
      id
      name
      documentType
    }
  }
}

query listStaffDocumentsByStatus(
  $status: DocumentStatus!
  $offset: Int
  $limit: Int
) @auth(level: USER) {
  staffDocuments(
    where: { status: { eq: $status } }
    offset: $offset
    limit: $limit
  ) {
    id
    staffId
    staffName
    documentId
    status
    documentUrl
    expiryDate
    document {
      id
      name
      documentType
    }
  }
}
