import { IUser } from './user.d';
// #ifdef DEV
import dictionary from './user.store';
console.groupCollapsed('user');
console.log('port : ', location.port);
console.log(`dictionary[${location.port}] : `, dictionary[location.port]);
console.groupEnd();
localStorage.setItem(
  "userInfo",
  JSON.stringify(
    dictionary[location.port]
  )
)
// #endif

let user = reactive<IUser>(JSON.parse(localStorage.getItem('userInfo') as string))
console.log('user :>> ', user);
export default user

const ROLE_MAP: { [key: string]: 'teacher' | 'student' } = { '72': 'teacher', '75': 'teacher', '76': 'student' }
export const UserRole: 'teacher' | 'student' | 'admin' | 'other' = (user.sm_info.sm_id === '739' && user.user_id !== '326366') ? 'admin' : (ROLE_MAP[user.user_role_id] ?? 'other')
