ClassUMLDiagram - bounswe/bounswe2025group5 GitHub Wiki


classDiagram
    %% ---------------------------
    %% Package: User Management
    %% ---------------------------
    class RegisteredUser {
      - email: String
      - username: String
      - password: String
      - userId: int
      - totalXp: int
      - posts: List~Post~
      - badges: List~Badge~
      - goals: List~WasteGoal~
      + login(email: String, password: String): boolean
      + viewGoals(userId): List~WasteGoal~
      + resetPassword(email: String): void
      + deleteAccount(): boolean
      + logout(): void
      + createWasteGoal(name: String, duration: double, type: String, amount: double): void
      + logWaste(amount: double, type: String): void
      + deleteWasteGoal(goalId: int): boolean
      + redeemReward(rewardId: int): boolean
      + completeWasteGoal(goalId: int): Badge
      + viewChallenges(): List~Challenge~
      + getChallenges(): List~Challenge~
      + selectChallenge(challengeId: int): Challenge
      + getChallenge(challengeId: int): Challenge
    }
    
    class Moderator {
      + moderatePost(postId: int): void
      + reviewReports(reportId: int): void
      + approveRequestedChallenge(challengeId: int): int 
    }
    
    RegisteredUser <|-- Moderator

    RegisteredUser --> ForumFeed : accesses

    %% ---------------------------
    %% Package: Post Management
    %% ---------------------------
    class Post {
      - postId: int
      - content: String
      - attachments: List~String~
      - timestamp: Date
      - authorName: String
      - likes: int
      - comments: List~Comment~
    }
    
    class Comment {
      - commentId: int
      - content: String
      - timestamp: Date
      - authorUserId: int
      + editComment(newContent: String): boolean
    }
    
    Post "1" --> "*" Comment : has

    %% ---------------------------
    %% Package: Forum Feed
    %% ---------------------------
    class ForumFeed {
      - feedId: int
      - posts: List~Post~
      + getPosts(): List~Post~
      + createPost(content: String, attachments: List~String~): boolean
      + selectPost(postId: int): Post
      + deletePost(userId: int, postId: int): boolean
      + likePost(userId: int, postId: int): void
      + commentOnPost(userId: int, postId: int, comment: Comment): void
      + savePost(userId: int, postId: int): boolean
      + reportPost(postId: int, reason: String): void
      + search(prompt: String): String
    }
    
    ForumFeed "1" --> "*" Post : contains

    %% ---------------------------
    %% Package: Waste Tracking
    %% ---------------------------
    class WasteGoal {
      - goalId: int
      - date: Date
      - unit: String
      - wasteType: String  %% Allowed values: Plastic, Organic, Paper, Metal, Glass
      - percentOfProgress: double
      - reward: int
      - ownerId: int
      - duration: double
      - completed: boolean
      + visualize(): Image
      + returnPoints(pointAmount: int): void
      + checkCompletion(): boolean
    }
    
    class WasteLog {
      - logId: int
      - amount: double
      - wasteType: String  %% Allowed values: Plastic, Organic, Paper, Metal, Glass
      - goalId: int
      - userId: int
      + updateChallengeProgress(challengeId: int, amount: double): void
      + updateGoalProgress(): void
    }

    %% ---------------------------
    %% Package: Reporting & Challenges
    %% ---------------------------
    class Report {
      - reportId: int
      - reason: String
      - reportDate: Date
      - status: String
      + resolve(reportId: int): boolean
    }
    
    class Challenge {
      - challengeId: int
      - title: String
      - description: String
      - startDate: Date
      - endDate: Date
      - status: String  %% Allowed values: Active, Requested, Ended
      - participants: Map~int, double~
      + joinChallenge(challengeId: int): boolean
      + leaveChallenge(challengeId: int): boolean
      + requestChallenge(description: String, userId: int): int
      + getLoggedAmounts(userId: int, amount: double): void
      + updateLoggedAmounts(userId: int, loggedWaste: double): void
      + sendLoggedAmounts(userId: int, leaderboardId: int): double
      + deleteUserProgress(userId: int): int
      + rewardWinners(): void
      + viewLeaderboard(leaderboardId: int): Leaderboard
      + getLeaderboard(leaderboardId: int): Leaderboard
    }
    
    class Leaderboard {
      - leaderboardId: int
      - location: String
      - type: String  %% Allowed values: Plastic, Organic, Paper, Metal, Glass
      - usersList: List~int~
      + updateRanking(userId: int, leaderboardId: int): void
    }
    
    RegisteredUser --> "*" Report : submits
    Moderator --> "*" Report : reviews
    Moderator --> "*" Challenge : approves
    RegisteredUser --> "*" Challenge : participates
    RegisteredUser --> "*" Challenge : requests
    
    Challenge --> "1" Leaderboard : communicates

    %% ---------------------------
    %% Package: Profile & Rewards
    %% ---------------------------
    class Profile {
      - userName: String
      - photo: Image
      - biography: String
      - displayedBadges: List~Badge~
      + getPhoto(): Image
      + setPhoto(photo: Image): boolean
      + getBiography(): String
      + setBiography(biography: String): String
      + editProfile(flag: String): void
      + saveBadges(badges: List~Badge~): List~Badge~
      + selectBadges(badges: List~Badge~): List~Badge~
      + updateDispBadges(badges: List~Badge~): void
    }
    
    class Reward {
      - rewardId: int
      - description: String
      - pointsRequired: int
      + redeem(userId: int, points: int, rewardId: int): boolean
    }
    
    class Badge {
      - badgeId: int
      - description: String
      - criteria: String
    }
    
    class Notification {
      - notificationId: int
      - message: String
      - timestamp: Date
      - read: Boolean
      + sendNotification(notificationId: int, userId: int, content: String): boolean
      + markAsRead(notificationId: int): void
    }
    
    class User{
      + register(email: String, password: String): boolean
      + viewForum(): void
      + viewProfiles(): void 
      + passwordAccuracy(password: String): boolean
    }
    
    User --> "*" Profile : views
    RegisteredUser --> Profile : has
    RegisteredUser --> "*" Reward : redeems
    RegisteredUser --> "*" Badge : earns
    WasteGoal --> Badge : awards
    RegisteredUser --> "*" Notification : receives
    
    %% ---------------------------
    %% Cross-Package Associations
    %% ---------------------------
    RegisteredUser --> "*" WasteGoal : creates
    RegisteredUser --> "*" WasteLog : logs
    RegisteredUser --> "*" Report : submits
    User --> "*" ForumFeed : views