---
config:
  layout: dagre
---
classDiagram
direction TB
    class User {
	    id: String
	    email: String
    }

    class Vendor {
	    id: UUID
	    userId: String
	    companyName: String
	    tier: VendorTier
    }

    class Staff {
	    id: UUID
	    userId: String
	    fullName: String
    }

    class VendorBenefitPlan {
	    id: UUID
	    vendorId: UUID
	    title: String
    }

    class InvoiceTemplate {
	    id: UUID
	    name: String
	    ownerId: UUID
    }

    class VendorRate {
	    id: UUID
	    vendorId: UUID
	    roleName: String
    }

    class AttireOption{
	    id: UUID
	    vendorId: UUID
    }

    class Team {
	    id: UUID
	    teamName: String
	    ownerId: String
    }

    class TeamMember {
	    id: UUID
	    teamId: UUID
	    userId: String
	    role: TeamMemberRole
    }

    class TeamHub {
	    id: UUID
	    teamId: UUID
	    hubName: String
    }

    class Business {
	    id: UUID
	    userId: String
	    businessName: String
    }

    class ClientFeedback {
	    id: UUID
	    businessId: UUID
	    vendorId: UUID
	    rating: Int
    }

    class Order {
	    id: UUID
	    vendorId: UUID
	    businessId: UUID
	    status: OrderStatus
    }

    class Shift {
	    id: UUID
	    orderId: UUID
	    status: ShiftStatus
    }

    class Role {
	    id: UUID
	    name: String
	    vendorId: UUID
    }

    class ShiftRole {
	    shiftId: UUID
	    roleId: UUID
    }

    class Workforce {
	    id: UUID
	    vendorId: UUID
	    staffId: UUID
	    status: WorkforceStatus
    }

    class Application {
	    id: UUID
	    shiftId: UUID
	    staffId: UUID
	    roleId: UUID
	    status: ApplicationStatus
    }

    class Assignment {
	    id: UUID
	    workforceId: UUID
	    shiftId: UUID
	    roleId: UUID
	    status: AssignmentStatus
    }

    class Invoice {
	    id: UUID
	    vendorId: UUID
	    businessId: UUID
	    orderId: UUID
	    status: InvoiceStatus
    }

    class RecentPayment {
	    id: UUID
	    staffId: UUID
	    applicationId: UUID
	    invoiceId: UUID
	    status: RecentPaymentStatus
    }

	note for Vendor "All tables has relationship with vendor"

    User "1" -- "1" Vendor : has
    Vendor "1" o-- "1" Staff : (ownerId)
    Vendor "1" -- "*" VendorBenefitPlan : offers
    Vendor "1" -- "*" AttireOption
    Vendor o-- InvoiceTemplate : (ownerId)
    Vendor "1" -- "*" VendorRate : has
    Vendor "1" -- "*" ClientFeedback : receives
    Vendor "1" -- "*" Order : receives
    Business "1" -- "*" Order : places
    Order "1" -- "*" Shift : contains
    Shift "1" -- "*" ShiftRole : requires
    Role "1" -- "*" ShiftRole : fills
    ShiftRole "1" -- "*" Application : receives
    Assignment "1" -- "1" ShiftRole
    Assignment "1" -- "1" Workforce
    Invoice "1" -- "1" Order
    Invoice "1" -- "*" RecentPayment : details
    Vendor "1" o-- "1" Team
    Team "1" -- "*" TeamHub : contains
    Team "1" -- "*" TeamMember : has