/* ───────────────────────────────────────────────────────────
   iban-data.jsx — données & icônes du parcours « Attestation IBAN »
   Acte 1 : la banque émet l'attestation IBAN dans le wallet (OpenID4VCI)
   Acte 2 : l'opérateur télécom consomme identité + IBAN (OpenID4VP)
   ─────────────────────────────────────────────────────────── */

// — Attestation IBAN émise par la banque (QEAA, terminologie ARF) —
// Les champs s'appuient sur le profil client courant (titulaire).
function ibanAttestation(profile) {
  return {
    docType: 'eu.europa.ec.eudi.iban_attestation.1',
    label: 'Attestation de compte bancaire',
    shortLabel: 'IBAN — Compte courant',
    issuer: 'Banque Démo',
    issuerKind: 'Établissement de crédit agréé (ACPR)',
    format: 'SD-JWT VC',
    titulaire: `${profile.prenom} ${profile.nom}`,
    iban: 'FR76 3000 4000 0312 3456 7890 143',
    bic: 'BDEMFRP1XXX',
    banque: 'Banque Démo',
    emisLe: "aujourd'hui",
    valable: '3 ans',
  };
}

// — Champs demandés par l'opérateur en Acte 2 (présentation combinée) —
// Deux sources : le PID (identité) + l'attestation IBAN (QEAA).
const TEL_IDENTITY_CLAIMS = [
  { key: 'photo',         label: "Photo d'identité",  isPhoto: true },
  { key: 'prenom',        label: 'Prénom(s)' },
  { key: 'nom',           label: 'Nom de famille' },
  { key: 'dateNaissance', label: 'Date de naissance' },
];

// — Offre commerciale de l'opérateur —
const TEL_OFFER = {
  brand: 'Téléo Mobile',
  plan: 'Forfait 5G — 120 Go',
  price: '14,99',
  commitment: 'Sans engagement',
  perks: ['Appels/SMS/MMS illimités', '120 Go en France · 25 Go en Europe', 'eSIM activable immédiatement'],
};

// ── Icônes complémentaires (style cohérent avec data.jsx) ──
const IIc = {
  doc: (p = {}) => (
    <svg viewBox="0 0 24 24" width={p.s || 20} height={p.s || 20} fill="none"
      stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.7} strokeLinecap="round" strokeLinejoin="round">
      <path d="M6 2.5h8l4 4V21a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1z" />
      <path d="M14 2.5V7h4M8.5 13h7M8.5 16.5h7" />
    </svg>
  ),
  sim: (p = {}) => (
    <svg viewBox="0 0 24 24" width={p.s || 20} height={p.s || 20} fill="none"
      stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.7} strokeLinecap="round" strokeLinejoin="round">
      <path d="M7 3h7l4 4v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z" />
      <rect x="9" y="11" width="6" height="6" rx="1" /><path d="M9 14h6M12 11v6" />
    </svg>
  ),
  signal: (p = {}) => (
    <svg viewBox="0 0 24 24" width={p.s || 20} height={p.s || 20} fill="none"
      stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.7} strokeLinecap="round" strokeLinejoin="round">
      <path d="M5 18v-3m4.5 3v-7M14 18V8m4.5 10V4" />
    </svg>
  ),
  plus: (p = {}) => (
    <svg viewBox="0 0 24 24" width={p.s || 20} height={p.s || 20} fill="none"
      stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 5v14M5 12h14" />
    </svg>
  ),
  download: (p = {}) => (
    <svg viewBox="0 0 24 24" width={p.s || 20} height={p.s || 20} fill="none"
      stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.8} strokeLinecap="round" strokeLinejoin="round">
      <path d="M12 4v11m-5-5l5 5 5-5M5 20h14" />
    </svg>
  ),
  wallet: (p = {}) => (
    <svg viewBox="0 0 24 24" width={p.s || 20} height={p.s || 20} fill="none"
      stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.7} strokeLinecap="round" strokeLinejoin="round">
      <rect x="3" y="6" width="18" height="13" rx="2.5" /><path d="M3 10h18M16 14.5h2" />
    </svg>
  ),
  back: (p = {}) => (
    <svg viewBox="0 0 24 24" width={p.s || 20} height={p.s || 20} fill="none"
      stroke={p.c || 'currentColor'} strokeWidth={p.w || 2} strokeLinecap="round" strokeLinejoin="round">
      <path d="M19 12H5m6 6l-6-6 6-6" />
    </svg>
  ),
  building: (p = {}) => (
    <svg viewBox="0 0 24 24" width={p.s || 20} height={p.s || 20} fill="none"
      stroke={p.c || 'currentColor'} strokeWidth={p.w || 1.7} strokeLinecap="round" strokeLinejoin="round">
      <rect x="5" y="3" width="14" height="18" rx="1.5" /><path d="M9 7h2m3 0h1M9 11h2m3 0h1M9 15h2m3 0h1M10 21v-3h4v3" />
    </svg>
  ),
};

Object.assign(window, { ibanAttestation, TEL_IDENTITY_CLAIMS, TEL_OFFER, IIc });
