import { Auth, Rank, User, RPCPermission, Character } from "../../Types/Types"
import { SpecT } from "../../Types/PlayerSpecs"

export type LoginManagerIfc = {
    Authenticator: {
        login: (username:string, pwHash:string) => Promise<Auth>
        logout: (username: string, tokenValue :string) => Promise<void>
        getAuth: (tokenValue: string) => Promise<Auth>
        checkToken: (token: string, rank: Rank) => Promise<boolean>
        createUser: (user:User) => Promise<User>
    }
}

export type LoginManagerFeatureIfc = {
    modifyPermissions: {
        setPermission: (perm: RPCPermission) => Promise<void>
        getPermissions: () => Promise<RPCPermission[]>
    }
}

export type CharacterManagerIfc = {
    CharacterManager: {
        getSpecId : <c extends keyof SpecT>(clazz: c, name: SpecT[c]) => Promise<number>
        getCharacters : () => Promise<Character[]>
    }
}

export type CharacterManagerFeatureIfc = {
    createCharacter: {
        createCharacter: (usertoken: string, char : Character) => Promise<Character>
    }
}