import {ORGANISATION} from './organisation-model.mjs'; // Presentation follows current appointments; seals never grant authority. export const FUNCTION_SEALS=Object.freeze(Object.fromEntries(ORGANISATION.flatMap(d=>[d,...d.branches]).map(s=>[s.key,{key:'function-'+s.key,label:s.label,file:'scope-'+s.key+'-v1-150.png'}]))); export const PERSONAL_SEALS=Object.freeze({ unimatrix999:{role:'org_owner_ceo',file:'personal-unimatrix999-ceo-v1'}, grmacken:{role:'org_executive',file:'personal-grmacken-cto-v1'}, richwjr:{role:'org_executive',file:'personal-richwjr-coo-v1'}, mr_blueray:{role:'org_executive',file:'personal-mr_blueray-cco-v1'}, ...Object.fromEntries(['am_mk','larry7517','mustafaje','s_oio_s','the_game_lordyt','tyrario1703'].map(name=>[name,{file:'personal-staff-'+name+'-v1'}])), bedrock_s73ffupk7hx:{file:'personal-staff-s73ffupk7hx-v1'} ,...Object.fromEntries(['yooshi','racoonvibz','halobeau143'].map(name=>[name,{file:'personal-staff-'+name}])) }); export function organisationPersonalSeal(username,ranks=[]){ const asset=PERSONAL_SEALS[String(username).toLowerCase()]; if(!asset||!ranks.some(r=>/^org_(owner_ceo|executive|department_head|branch_lead|officer)$/.test(r)))return null; // Executive titles are personal and only valid while holding that appointment. if(asset.role&&!ranks.includes(asset.role))return null; return '/assets/seals/'+asset.file+'-150.png'; } export function organisationFunctionSeals(assignments=[]){ return [...new Set(assignments.filter(a=>['department','branch'].includes(a.scopeType??a.scope_type)).map(a=>a.scopeKey??a.scope_key))].flatMap(key=>FUNCTION_SEALS[key]?[FUNCTION_SEALS[key]]:[]); }