@startuml
skin rose
skinparam backgroundColor #EEEBDC
left to right direction

!define Cloud(name, description) usecase "description" as name [[name]] #DarkGray
!define Kite(name, description) usecase "description" as name [[name]] #Yellow
!define Sea(name, description) usecase "description" as name [[name]] #LightBlue
!define Fish(name, description) usecase "description" as name [[name]] #LightGray
!define Clam(name, description) usecase "description" as name [[name]] #Silver

<style>
package {
  LineColor transparent
  BackgroundColor transparent
  Shadowing 0
  FontColor transparent
}
</style>

<style>
.visiblePackage {
  LineColor black
  Shadowing 1
  FontColor black
}
</style>
hide <<visiblePackage>> stereotype

/' package "TaskHub" <<visiblePackage>> { '/
package "TaskHub" {
actor User as user
actor Guest as guest
actor Admin as admin

' Auth
package "Auth" {
  actor "Google Auth Provider" as google
/' Cloud(auth, "Authentication") '/
/' guest '1' -- '' auth '/
  Kite(auth_login, "Login")
  Kite(auth_register, "Registration")
  guest "1" --- "0..1" auth_login
  guest "1" --- "0..*" auth_register

  Sea(register_email, "Register via Email")
  auth_register ..> register_email : <<include>>

  Fish(enter_email, "Enter Email without confirmation")
  Fish(enter_email_confirm, "Enter Email with confirmation")
  Fish(enter_password, "Enter Passwounrd")
  Fish(enter_username, "Enter Username")
  register_email ..> enter_email_confirm : <<include>>
  register_email ..> enter_password: <<include>>
  register_email ..> enter_username : <<include>>

  Sea(login_google, "Login via Google OAuth")
  auth_login <.. login_google : <<extend>>

  Fish(choose_account, "Choose Google account")
  login_google ..> choose_account : <<include>>

  choose_account "0..*" -- "1" google

  Sea(login_email, "Login via Email")
  auth_login <.. login_email: <<extend>>

  login_email ..> enter_email : <<include>>
  login_email ..> enter_password: <<include>>

  Sea(recover_password, "Password Recovery")
  auth_login <.. recover_password : <<extend>>

  Fish(enter_password_new, "Enter New Password")
  recover_password ..> enter_email_confirm : <<include>>
  recover_password ..> enter_password_new : <<include>>
}

package "Own Task Managment"  {
  Kite(own_task_create, "Create new Task")
  user "1" --- "0..*" own_task_create
  Sea(own_task_create_name, "Enter Task Name")
  Sea(own_task_create_visibility, "Select Task Visibility")
  own_task_create ..> own_task_create_name : <<include>>
  own_task_create ..> own_task_create_visibility : <<include>>

  Kite(own_task_delete, "Delete Task")
  user "1" --- "0..*" own_task_delete
  Sea(own_task_delete_confirm, "Enter Confirmation Code form Email")
  own_task_delete ..> own_task_delete_confirm : <<include>>

  Kite(own_task_update, "Update Task Attachments")
  user "1" --- "0..*" own_task_update
  Sea(own_task_update_type, "Select Attachment Type")
  Sea(own_task_update_content, "Select Attachment Content")
  Sea(own_task_update_visibility, "Select Attachment visibility")
  own_task_update ..> own_task_update_type : <<include>>
  own_task_update ..> own_task_update_content : <<include>>
  own_task_update ..> own_task_update_visibility : <<include>>

  Kite(own_task_visibility, "Change visibility of the Task")
  user "1" --- "0..*" own_task_visibility
  Sea(own_task_visibility_private, "Set Private Task Visibility")
  Sea(own_task_visibility_public, "Set Public Task Visibility")
  Sea(own_task_visibility_paid, "Set Paid Task Visibility")
  own_task_visibility <.. own_task_visibility_private : <<extend>>
  own_task_visibility <.. own_task_visibility_public : <<extend>>
  own_task_visibility <.. own_task_visibility_paid : <<extend>>

  Kite(own_task_requests, "Manage Tasks Requests")
  user "1" --- "0..*" own_task_requests
  Sea(own_task_request_approve, "Approve Task Request")
  Sea(own_task_request_decline, "Decline Task Request")
  own_task_requests <.. own_task_request_approve : <<extend>>
  own_task_requests <.. own_task_request_decline : <<extend>>

  Kite(own_task_access, "Manage Task Access Rights")
  user "1" --- "0..*" own_task_access

  Sea(own_task_access_add, "Give Access for User")
  Sea(own_task_access_remove, "Remove Access of the User")
  Sea(own_task_access_update, "Update Access of the User")

  own_task_access <.. own_task_access_add : <<extend>>
  own_task_access <.. own_task_access_remove : <<extend>>
  own_task_access <.. own_task_access_update : <<extend>>
/' } '/

package "Other Tasks Interactions" {
  actor "Payment Provider" as payment
  Kite(task_fork, "Fork existing Task")
  user "1" --- "0..*" task_fork

  Sea(task_fork_options, "Select Fork Options")
  task_fork ..> task_fork_options : <<include>>

  Kite(other_task_request_managment, "Manage Task Requests")
  user "1" --- "0..*" other_task_request_managment

  Sea(request_add, "Add Attachment Request")
  Sea(request_update, "Update Attachment Request")
  Sea(request_remove, "Remove Attachment Request")
  Sea(request_revoke, "Revoke existing Request")
  other_task_request_managment <.. request_add : <<extend>>
  other_task_request_managment <.. request_update: <<extend>>
  other_task_request_managment <.. request_remove : <<extend>>
  other_task_request_managment <.. request_revoke : <<extend>>

  Kite(buy_task, "Buy Paid Task")
  user "1" --- "0..*" buy_task

  Sea(select_payment, "Select Payment Method")
  buy_task ..> select_payment : <<include>>

  select_payment "0..*" -- "1" payment
}

package "Admin Panel" {
  Kite(manage_users, "Manage Users")
  admin "1" --- "0..*" manage_users
  
  Sea(review_users, "Review User Details")
  manage_users ..> review_users : <<include>>

  Fish(create_user, "Create New User")
  Fish(view_user_profile, "View Private Data")
  Fish(delete_user_admin, "Delete User")
  Fish(block_user_admin, "Block User")
  review_users <.. create_user : <<extend>>
  review_users <.. view_user_profile : <<extend>>
  review_users <.. delete_user_admin : <<extend>>
  review_users <.. block_user_admin : <<extend>>

  Kite(manage_content, "Manage Content")
  admin "1" --- "0..*" manage_content

  Sea(review_content, "Review Content Details")
  manage_content ..> review_content : <<include>>

  Fish(approve_content, "Approve Content")
  Fish(remove_content, "Remove Content")
  Fish(warn_user, "Warn Content Author")
  review_content <.. approve_content : <<extend>>
  review_content <.. remove_content : <<extend>>
  review_content <.. warn_user : <<extend>>
}

package "Task Group Management"  {
  actor "Github Integration Provider" as github

  Kite(manage_tasks_in_groups, "Manage Tasks in Groups")
  Kite(manage_user_access, "Manage User's Access")
  Kite(manage_users_tg, "Manage Users")
  Kite(tg_manage_github, "Manage Github Integration")
  user "1" --- "0..*" manage_users_tg
  user "1" --- "0..*" manage_tasks_in_groups
  user "1" --- "0..*" manage_user_access
  user "1" --- "0..*" tg_manage_github

  Sea(add_user, "Add User")
  Sea(delete_user, "Delete User")
  manage_users_tg ..> add_user : <<include>>
  manage_users_tg ..> delete_user : <<include>>

  Sea(set_user_access, "Change Access Level")
  manage_user_access ..> set_user_access : <<include>>

  Sea(tg_add_task, "Add Task to Group")
  Sea(tg_create_task, "Create new Task in Group")
  Sea(tg_remove_task, "Remove Task from Group")
  manage_tasks_in_groups <.. tg_add_task : <<extend>>
  manage_tasks_in_groups <.. tg_create_task : <<extend>>
  manage_tasks_in_groups <.. tg_remove_task : <<extend>>

  Sea(github_link_repository, "Link GitHub repository to the Group")
  Sea(github_unlink_repository, "Unlink GitHub repository from the Group")
  tg_manage_github <.. github_link_repository : <<extend>>
  tg_manage_github <.. github_unlink_repository : <<extend>>

  github_link_repository "0..*" -- "1" github
  github_unlink_repository "0..*" -- "1" github
}

}
@enduml
