enum TeamMemberRole {
  OWNER
  ADMIN
  MEMBER
  MANAGER
  VIEWER
}

enum TeamMemberInviteStatus {
  PENDING
  ACCEPTED
  #EXPIRED
  CANCELLED
}

type TeamMember @table(name: "team_members") {
  id: UUID! @default(expr: "uuidV4()")
  
  teamId: UUID!
  team: Team! @ref(fields: "teamId", references: "id")

  userId: String!
  user: User! @ref(fields: "userId", references: "id")
  
  role: TeamMemberRole!
  title: String
  department: String

  teamHubId: UUID
  teamHub: TeamHub @ref(fields: "teamHubId", references: "id")

  isActive: Boolean @default(expr: "true")

  inviteStatus: TeamMemberInviteStatus @default(expr: "'PENDING'")
  inviteCode: UUID! @default(expr: "uuidV4()")

  createdAt: Timestamp @default(expr: "request.time")
  updatedAt: Timestamp @default(expr: "request.time")
  createdBy: String
}
