@startuml



class TeamGateway{

    + __construct(con : Connexion)
    + insert(name : string ,picture : string, mainColor : Color, secondColor : Color)
    + listByName(name : string): array
    + getTeamById(id:int): ?TeamInfo
    + getTeamIdByName(name:string): ?int
    + deleteTeam(idTeam:int): void
    + editTeam(idTeam:int, newName:string, newPicture:string, newMainColor:string, newSecondColor:string)
    + getAll(user:int): array
}

TeamGateway *--"- con" Connexion


class MemberGateway{

    + __construct(con : Connexion)
    + insert(idTeam:int, userId:int, role:string): void
    + getMembersOfTeam(teamId:int): array
    + remove(idTeam:int, idMember:int): void
    + isCoach(email:string, idTeam:int): bool
    + isMemberOfTeam(idTeam:int, idCurrentUser:int): bool
}

MemberGateway *--"- con" Connexion

class AccountGateway{
    + __construct(con : Connexion)
    + insertAccount(name:string, email:string, token:string, hash:string, profilePicture:string): int
    + getRowsFromMail(email:string): ?array
    + getHash(email:string): ?string
    + exists(email:string): bool
    + getAccountFromMail(email:string): ?Account
    + getAccountFromToken(token:string): ?Account
}

AccountGateway *--"- con" Connexion

class TeamModel{

    + __construct(gateway : TeamGateway)
    + createTeam(name : string,picture : string, mainColorValue : int, secondColorValue : int, errors : array)
    + addMember(mail:string, teamId:int, role:string): int
    + listByName(name : string ,errors : array) : ?array
    + getTeam(idTeam:int, idCurrentUser:int): ?Team
    + deleteMember(idMember:int, teamId:int): int
    + deleteTeam(email:string, idTeam:int): int
    + isCoach(idTeam:int, email:string): bool
    + editTeam(idTeam:int, newName:string, newPicture:string, newMainColor:string, newSecondColor:string)
    + getAll(user:int): array
}

TeamModel *--"- members" MemberGateway
TeamModel *--"- teams" TeamGateway
TeamModel *--"- teams" AccountGateway


class TeamController{
    + __construct( model : TeamModel)
    + displayCreateTeam(session:SessionHandle): ViewHttpResponse
    + displayDeleteMember(session:SessionHandle): ViewHttpResponse
    + submitTeam(request:array, session:SessionHandle): HttpResponse
    + displayListTeamByName(session:SessionHandle): ViewHttpResponse
    + listTeamByName(request:array, session:SessionHandle): HttpResponse
    + deleteTeamById(id:int, session:SessionHandle): HttpResponse
    + displayTeam(id:int, session:SessionHandle): ViewHttpResponse
    + displayAddMember(idTeam:int, session:SessionHandle): ViewHttpResponse
    + addMember(idTeam:int, request:array, session:SessionHandle): HttpResponse
    + deleteMember(idTeam:int, idMember:int, session:SessionHandle): HttpResponse
    + displayEditTeam(idTeam:int, session:SessionHandle): ViewHttpResponse
    + editTeam(idTeam:int, request:array, session:SessionHandle): HttpResponse
}

TeamController *--"- model" TeamModel





class Connexion { }

@enduml