import * as SecureStore from 'expo-secure-store';
export type MobileSession={accessToken:string;refreshToken:string;user:{id:string;name:string;email:string;phone?:string|null;role:string;forcePasswordChange:boolean;employeeCode?:string|null}};
const KEY='colorjet.mobile.session.v1';
export async function getSession():Promise<MobileSession|null>{try{const raw=await SecureStore.getItemAsync(KEY);return raw?JSON.parse(raw) as MobileSession:null;}catch{return null;}}
export async function saveSession(session:MobileSession){await SecureStore.setItemAsync(KEY,JSON.stringify(session));}
export async function clearSession(){await SecureStore.deleteItemAsync(KEY);}
