export interface EgovUser {
    id: number
    email: string
    firstname: string
    lastname: string,
    firstname_en: string
    lastname_en: string,
    phone: string,
    mobile_phone: string,
    building_id: string,
    phone_ext: string,
    default_unit: string,
    default_unit_id?: number,
    skype: string,
    webpage: string
    hasEmergencyPassword?: boolean
    roles: Role[];
    permissions: Permissions
    permissions_plain: any
    microservice_permissions: MicroservicePermissions
    quickAccess: string[]
    personalNote: any
    defaultSignature: any
    beams_enabled: 0 | 1
    profile_settings: Record<string, boolean>
    dua_code:string
    contract_dates:string
    card_date:string
    rank: string
    work_relation_id: number
    staff_category:string
    difo_code: string | null
}

// interface ProfileSettings


export interface contactsProfile {
    email: string
    firstname: string
    lastname: string,
    firstname_en: string
    lastname_en: string,
    phone: string,
    building_id: string;
    phone_ext: string,
    default_unit: string,
    skype: string,
    webpage: string


}

export interface Translations {
    'roles': Record<Role, {
        view_name: string,

    }>,
    'microservices': Record<Microservice, {
        'view_name': string
        description: string
        filepath?: string
    }>,
    'modules': Record<string, {
        filepath?: string
        'view_name': string
        description: string
    }>,
    'permissions': Record<string, {
        'view_name': string
    }>,
}

export type Permissions = Record<Role, RolePermissions>

export type RolePermissions = Record<string, ModulePermissions>

interface ModulePermissions {
    default_view: string
    permissions: string[]
    quick: string[]
    rules: {
        [key: string]: boolean
    }
    extra_auth: string[]
    allowedActions?: {
        'canList': boolean,
        'canView': boolean,
        'canAdd': boolean,
        'canEdit': boolean,
        'canDelete': boolean,
    }

}

export type Role =
    'dua_user'
    | 'president'
    | 'director'
    | 'researcher'
    | 'gate_keeper'
    | 'network_manager'
    | 'demo_role'
    | 'help_desk'
| 'scientific_supervisor'
    |'project_manager'
    | 'supervisor_elke'
    | 'hr_manager'
    ;
export type Microservice =
    'rescom'
    | 'riview'
    | 'contacts'
    | 'dpass'
    | 'settings'
    | 'support'
    | 'net_support'
    | 'applio'
    | 'difo'
    | 'hr_support';

export type MicroservicePermissions = Partial<Record<Microservice, string[]>>

export interface AppSettings {
    ldapIsDown: boolean,
    loginIsDisabled: boolean,
}


export interface PreLoginSettingsRes {
    'settings': PreLoginSettings,
    'requested_at': string
}

export type PreLoginSettings = Record<string, PreLoginSetting>

export interface PreLoginSetting {
    'message': string,
    'status': 0 | 1,
}
