@startuml

package Controller <<Rectangle>> {
    abstract class Network {
   
    }


    class NetworkManager {
        sendMessage(message, ip, port, id)
        receiveMessage(message, id)
        broadcast(message)
    }

    class IdManager {
        getNextID()
    }

    class ThreadManager {
        ThreadList : ThreadList
        NewThread()
    }

    class TCPNetworkManager {
        connect(port, ip);
        send(port, ip, message);
        receiveMessage(message, id)
    }

    class AccountManager {
        connection()
        setName(Name : String)
        deconnection()
    }

    class ConversationManager {
        addMessage(message,conversation)
        getHistorique()
        getListeUtilisateurs()
    }

    class BroadcastNetworkManager {
        pingSend(message)
    }

    NetworkManager <--- BroadcastNetworkManager
    NetworkManager <--- TCPNetworkManager

    TCPNetworkManager <|-- Network
    BroadcastNetworkManager <|-- Network
    AccountManager -- NetworkManager
    ConversationManager -- NetworkManager
}

'=============================================='

package Model <<Rectangle>> {

    class Conversation {
        user : User
        listeMessage : Arraylist<Message>
    }

    class Message{
        user : User
        body : String
        date : Date
        sender : Boolean /'1 si c'est le User de l'app le sender, 0 sinon'/
        id : Int
    }

    class ThreadList{
        listThread : Arraylist<Thread>
    }
    
    class User{
        name : String
        id : Int
        status : Boolean 'connecté ou non'
        port : Int
        ip : Inet_Addr
    }
    
    class Annuaire {
        listUser : Arraylist<User>
    }

    Conversation "1" <-- "*" User /'notes to self'/
    Conversation "1" <-- "*" Message
    Message "*" <-- "*" User 

    Annuaire "1" <-- "*" User
}


'=============================================='


package View <<Rectangle>> {

    abstract class Display {
        SetDarkMode()  
    }

    class UserListDislay {
        afficherUtilisateurs()
    }

    class MessageDislay {
        afficherMessages()
    }

    class FirstLoginDisplay {
        
    }

    class ChangePseudoDisplay {
        
    }

    UserListDislay <|-- Display
    MessageDislay <|-- Display
    FirstLoginDisplay <|-- Display
    ChangePseudoDisplay <|-- Display

}

AccountManager -- User

ThreadManager <--- ThreadList
Model ----- ConversationManager


@enduml
