// Sample password vault data — French names, realistic mix.
// Each entry can have multiple accounts (e.g. perso + pro) and multiple TOTP codes.

const ENTRIES = [
  {
    id: 'e1', name: 'Amazon', domain: 'amazon.fr', category: 'shopping',
    folderId: 'perso', favorite: true, modified: 'today, 14:32',
    color: '#FF9900', strength: 'strong', shared: false,
    accounts: [
      { id: 'a1', label: 'Personnel', username: 'lucas.martin@gmail.com', password: 'kJ8#mP2vQx9!nL4w', created: '12 mars 2024' },
      { id: 'a2', label: 'Pro', username: 'l.martin@dcaf.fr', password: 'Zr5@hT8bN3*pY6cE', created: '8 jan 2025' },
    ],
    totp: [
      { id: 't1', label: 'Personnel', secret: 'JBSWY3DPEHPK3PXP', code: '472 891', period: 30, remaining: 18 },
    ],
    notes: 'Compte familial Prime partagé.',
  },
  {
    id: 'e2', name: 'GitHub', domain: 'github.com', category: 'dev',
    folderId: 'travail', favorite: true, modified: 'hier, 09:14',
    color: '#1a1a1a', strength: 'strong', shared: true,
    accounts: [
      { id: 'a3', label: 'Principal', username: 'lucas-m', password: 'gH7$bX9wK2!rT5pV', created: '4 fév 2023' },
    ],
    totp: [
      { id: 't2', label: 'Authenticator', secret: 'HXDMVJECJJWSRB3H', code: '038 562', period: 30, remaining: 18 },
      { id: 't3', label: 'Backup YubiKey', secret: 'KZWGCJGEHV4UCM2D', code: '917 244', period: 30, remaining: 18 },
    ],
    notes: '',
  },
  {
    id: 'e3', name: 'Google', domain: 'google.com', category: 'tech',
    folderId: 'perso', favorite: true, modified: '3 jours',
    color: '#4285F4', strength: 'strong', shared: false,
    accounts: [
      { id: 'a4', label: 'Gmail principal', username: 'lucas.martin@gmail.com', password: 'mN4#kQ8wP1!xR6tA', created: '2019' },
      { id: 'a5', label: 'YouTube créateur', username: 'lucas.creates@gmail.com', password: 'pK9@vB3hN7*qW2sD', created: 'sept 2022' },
    ],
    totp: [
      { id: 't4', label: 'Gmail', secret: 'GEZDGNBVGY3TQOJQ', code: '624 109', period: 30, remaining: 18 },
    ],
    notes: '',
  },
  {
    id: 'e4', name: 'Netflix', domain: 'netflix.com', category: 'media',
    folderId: 'famille', favorite: false, modified: '1 sem',
    color: '#E50914', strength: 'medium', shared: true,
    accounts: [
      { id: 'a6', label: 'Famille', username: 'martin.famille@gmail.com', password: 'NetflixFamille2025', created: '2020' },
    ],
    totp: [],
    notes: 'Profil Lucas verrouillé par PIN 4 chiffres.',
  },
  {
    id: 'e5', name: 'Apple', domain: 'apple.com', category: 'tech',
    folderId: 'perso', favorite: true, modified: '2 sem',
    color: '#000000', strength: 'strong', shared: false,
    accounts: [
      { id: 'a7', label: 'Apple ID', username: 'lucas.martin@icloud.com', password: 'aP9#mK4vL2!xN8rT', created: '2018' },
    ],
    totp: [],
    notes: '',
  },
  {
    id: 'e6', name: 'Stripe', domain: 'stripe.com', category: 'finance',
    folderId: 'travail', favorite: false, modified: '4 jours',
    color: '#635BFF', strength: 'strong', shared: true,
    accounts: [
      { id: 'a8', label: 'Dashboard prod', username: 'admin@dcaf.fr', password: 'sT6@yU4vR9!jP2qM', created: 'mai 2024' },
      { id: 'a9', label: 'Test', username: 'test@dcaf.fr', password: 'kE3#wB7nL5!gQ8xH', created: 'mai 2024' },
    ],
    totp: [
      { id: 't5', label: 'Admin 2FA', secret: 'NB2W45DFOIZA', code: '551 230', period: 30, remaining: 18 },
    ],
    notes: 'Accès facturation client réservé à l\'équipe finance.',
  },
  {
    id: 'e7', name: 'Figma', domain: 'figma.com', category: 'design',
    folderId: 'travail', favorite: true, modified: '5 jours',
    color: '#F24E1E', strength: 'strong', shared: true,
    accounts: [
      { id: 'a10', label: 'Workspace DCAF', username: 'lucas@dcaf.fr', password: 'fG8#dR3kM6!hZ9wB', created: 'oct 2023' },
    ],
    totp: [],
    notes: '',
  },
  {
    id: 'e8', name: 'LinkedIn', domain: 'linkedin.com', category: 'social',
    folderId: 'perso', favorite: false, modified: '2 mois',
    color: '#0A66C2', strength: 'weak', shared: false,
    accounts: [
      { id: 'a11', label: 'Profil', username: 'lucas.martin@gmail.com', password: 'linkedin123', created: '2017' },
    ],
    totp: [],
    notes: '',
  },
  {
    id: 'e9', name: 'Discord', domain: 'discord.com', category: 'social',
    folderId: 'perso', favorite: false, modified: '3 sem',
    color: '#5865F2', strength: 'medium', shared: false,
    accounts: [
      { id: 'a12', label: 'Principal', username: 'lucas#4827', password: 'DiscordPass2024!', created: '2021' },
    ],
    totp: [
      { id: 't6', label: 'Discord', secret: 'JBSWY3DPEHPK3PXP', code: '208 377', period: 30, remaining: 18 },
    ],
    notes: '',
  },
  {
    id: 'e10', name: 'Spotify', domain: 'spotify.com', category: 'media',
    folderId: 'famille', favorite: false, modified: '1 mois',
    color: '#1DB954', strength: 'medium', shared: true,
    accounts: [
      { id: 'a13', label: 'Famille Premium', username: 'martin.famille@gmail.com', password: 'SpotifyFam2024', created: '2022' },
    ],
    totp: [],
    notes: '',
  },
  {
    id: 'e11', name: 'OVH', domain: 'ovh.com', category: 'dev',
    folderId: 'travail', favorite: false, modified: '6 jours',
    color: '#123F6D', strength: 'strong', shared: true,
    accounts: [
      { id: 'a14', label: 'Compte client', username: 'dcaf-admin', password: 'oV7@kN3wR9!mP4tQ', created: 'fév 2022' },
    ],
    totp: [
      { id: 't7', label: 'OVH 2FA', secret: 'KZWGCJGEHV4UCM2D', code: '781 049', period: 30, remaining: 18 },
    ],
    notes: '',
  },
  {
    id: 'e12', name: 'Notion', domain: 'notion.so', category: 'productivity',
    folderId: 'travail', favorite: true, modified: '1 jour',
    color: '#191919', strength: 'strong', shared: true,
    accounts: [
      { id: 'a15', label: 'Workspace', username: 'lucas@dcaf.fr', password: 'nO5#tB8wK2!vL7xR', created: 'mars 2023' },
    ],
    totp: [],
    notes: '',
  },
  {
    id: 'e13', name: 'Slack', domain: 'slack.com', category: 'productivity',
    folderId: 'travail', favorite: false, modified: '2 jours',
    color: '#4A154B', strength: 'strong', shared: true,
    accounts: [
      { id: 'a16', label: 'DCAF Workspace', username: 'lucas@dcaf.fr', password: 'sL4@hG7nM2!pK9wB', created: '2023' },
    ],
    totp: [],
    notes: '',
  },
  {
    id: 'e14', name: 'Twitch', domain: 'twitch.tv', category: 'media',
    folderId: 'perso', favorite: false, modified: '2 mois',
    color: '#9146FF', strength: 'weak', shared: false,
    accounts: [
      { id: 'a17', label: 'Compte', username: 'lucas_streams', password: 'twitch2023', created: '2023' },
    ],
    totp: [],
    notes: '',
  },
  {
    id: 'e15', name: 'Crédit Agricole', domain: 'credit-agricole.fr', category: 'finance',
    folderId: 'banque', favorite: true, modified: '4 sem',
    color: '#009A3E', strength: 'strong', shared: false,
    accounts: [
      { id: 'a18', label: 'Compte courant', username: '38291047', password: 'cA9#mP4kL7!xN2vR', created: '2020' },
    ],
    totp: [
      { id: 't8', label: 'SecurePass', secret: 'JBSWY3DPEHPK3PXP', code: '339 715', period: 30, remaining: 18 },
    ],
    notes: 'Code carte: voir note sécurisée séparée.',
  },
  {
    id: 'e16', name: 'Boursorama', domain: 'boursorama.com', category: 'finance',
    folderId: 'banque', favorite: false, modified: '2 sem',
    color: '#E2001A', strength: 'strong', shared: false,
    accounts: [
      { id: 'a19', label: 'Bourso', username: 'lucas.martin@gmail.com', password: 'bR8@vK3hN6!pT2wM', created: '2021' },
    ],
    totp: [],
    notes: '',
  },
  {
    id: 'e17', name: 'Dropbox', domain: 'dropbox.com', category: 'productivity',
    folderId: 'perso', favorite: false, modified: '1 mois',
    color: '#0061FF', strength: 'medium', shared: false,
    accounts: [
      { id: 'a20', label: 'Personnel', username: 'lucas.martin@gmail.com', password: 'DropboxStorage2023', created: '2019' },
    ],
    totp: [],
    notes: '',
  },
  {
    id: 'e18', name: 'Vercel', domain: 'vercel.com', category: 'dev',
    folderId: 'travail', favorite: false, modified: '3 jours',
    color: '#000000', strength: 'strong', shared: true,
    accounts: [
      { id: 'a21', label: 'Team', username: 'lucas@dcaf.fr', password: 'vC6#wL9kP3!nR7tH', created: '2024' },
    ],
    totp: [],
    notes: '',
  },
  // ── Wi-Fi networks ─────────────────────────────────────
  {
    id: 'w1', type: 'wifi', name: 'Maison',
    ssid: 'Martin-Fibre-5G', security: 'WPA2', hidden: false,
    password: 'BlueBicycle92!Garden',
    folderId: 'perso', favorite: true, modified: 'aujourd\'hui',
    color: '#0EA5E9', strength: 'strong', shared: true,
    notes: 'Box Free fibre — antenne 5GHz au salon.',
  },
  {
    id: 'w2', type: 'wifi', name: 'Bureau DCAF',
    ssid: 'DCAF-Staff', security: 'WPA2-Enterprise', hidden: false,
    password: 'DcafStaff#2025!Office',
    folderId: 'travail', favorite: true, modified: '2 sem',
    color: '#6366F1', strength: 'strong', shared: true,
    notes: '',
  },
  {
    id: 'w3', type: 'wifi', name: 'Wi-Fi Invités',
    ssid: 'Martin-Guest', security: 'WPA2', hidden: false,
    password: 'BienvenueChezNous',
    folderId: 'perso', favorite: false, modified: '3 mois',
    color: '#10B981', strength: 'medium', shared: false,
    notes: 'Réseau isolé, sans accès au LAN principal.',
  },
  {
    id: 'w4', type: 'wifi', name: 'Maison de campagne',
    ssid: 'Vercors-Cottage', security: 'WPA2', hidden: true,
    password: 'MontagneEnchantee2024',
    folderId: 'famille', favorite: false, modified: '6 mois',
    color: '#F59E0B', strength: 'strong', shared: true,
    notes: 'SSID caché — utiliser le QR code pour connecter.',
  },
];

const FOLDERS = [
  { id: 'perso', name: 'Personnel', icon: 'home', count: 0, parentId: null,
    children: [
      { id: 'perso-mail', name: 'Email', icon: 'mail', count: 0 },
      { id: 'perso-social', name: 'Réseaux sociaux', icon: 'users', count: 0 },
    ]
  },
  { id: 'travail', name: 'Travail', icon: 'briefcase', count: 0, parentId: null,
    children: [
      { id: 'travail-dev', name: 'Développement', icon: 'code', count: 0 },
      { id: 'travail-tools', name: 'Outils SaaS', icon: 'tool', count: 0 },
    ]
  },
  { id: 'banque', name: 'Banque', icon: 'bank', count: 0, parentId: null, children: [] },
  { id: 'famille', name: 'Famille (partagé)', icon: 'family', count: 0, shared: true, parentId: null, children: [] },
];

const FILTERS = [
  { id: 'all',       label: 'Tous',           icon: 'all',     accent: '#6366F1', count: 0 },
  { id: 'passwords', label: 'Mots de passe',  icon: 'key',     accent: '#06B6D4', count: 0 },
  { id: 'totp',      label: '2FA',            icon: 'shield',  accent: '#F59E0B', count: 0 },
  { id: 'wifi',      label: 'Wi-Fi',          icon: 'wifi',    accent: '#0EA5E9', count: 0 },
  { id: 'passkeys',  label: 'Passkeys',       icon: 'fingerprint', accent: '#10B981', count: 0 },
  { id: 'favorites', label: 'Favoris',        icon: 'star',    accent: '#EC4899', count: 0 },
  { id: 'security',  label: 'Sécurité',       icon: 'alert',   accent: '#EF4444', count: 0 },
  { id: 'shared',    label: 'Partagés',       icon: 'share',   accent: '#8B5CF6', count: 0 },
];

// Normalize Wi-Fi entries to share the same shape as password entries
// (so list rendering, search, filters keep working unchanged).
ENTRIES.forEach(e => {
  if (e.type === 'wifi') {
    e.domain = e.ssid;
    e.accounts = e.accounts || [
      { id: e.id + '-a', label: 'SSID', username: e.ssid, password: e.password, created: '' },
    ];
    e.totp = e.totp || [];
  }
});

// Données de démo : utilisées uniquement quand l'utilisateur clique sur
// « Charger un coffre de démonstration » dans l'écran d'accueil. Le coffre
// réel est chiffré côté client et stocké dans la BDD MySQL via api.php.
window.CLEPASS_DEMO_DATA = { ENTRIES, FOLDERS, FILTERS };
