<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
          xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <!-- ===== PASS: specialize ===== -->
  <settings pass="specialize">
    <!-- Langue/clavier système -->
    <component name="Microsoft-Windows-International-Core"
               processorArchitecture="amd64"
               publicKeyToken="31bf3856ad364e35"
               language="neutral"
               versionScope="nonSxS">
      <InputLocale>fr-FR</InputLocale>
      <SystemLocale>fr-FR</SystemLocale>
      <UILanguage>fr-FR</UILanguage>
      <UserLocale>fr-FR</UserLocale>
    </component>

    <!-- Nom de machine, fuseau, infos enregistrées, branding -->
    <component name="Microsoft-Windows-Shell-Setup"
               processorArchitecture="amd64"
               publicKeyToken="31bf3856ad364e35"
               language="neutral"
               versionScope="nonSxS">
      <!-- Nom auto pour éviter les doublons -->
      <ComputerName>AGDI-%RAND%</ComputerName>

      <!-- Heure France/Europe centrale -->
      <TimeZone>Romance Standard Time</TimeZone>

      <!-- “Signature” AGDI -->
      <RegisteredOrganization>AGDI</RegisteredOrganization>
      <RegisteredOwner>William</RegisteredOwner>

      <!-- Branding (facultatif) : place ton logo BMP 120x120 env. -->
      <OEMInformation>
        <Manufacturer>AGDI</Manufacturer>
        <SupportPhone>02 57 830 130</SupportPhone>
        <SupportHours>Du lundi au vendredi, 9h–19h</SupportHours>
        <SupportURL>https://agdi.info</SupportURL>
        <Logo>C:\Windows\System32\oobe\info\backgrounds\agdi.bmp</Logo>
      </OEMInformation>
    </component>
  </settings>

  <!-- ===== PASS: oobeSystem ===== -->
  <settings pass="oobeSystem">
    <component name="Microsoft-Windows-International-Core"
               processorArchitecture="amd64"
               publicKeyToken="31bf3856ad364e35"
               language="neutral"
               versionScope="nonSxS">
      <InputLocale>fr-FR</InputLocale>
      <SystemLocale>fr-FR</SystemLocale>
      <UILanguage>fr-FR</UILanguage>
      <UserLocale>fr-FR</UserLocale>
    </component>

    <component name="Microsoft-Windows-Shell-Setup"
               processorArchitecture="amd64"
               publicKeyToken="31bf3856ad364e35"
               language="neutral"
               versionScope="nonSxS">

      <!-- Masquer les écrans OOBE pénibles -->
      <OOBE>
        <HideEULAPage>true</HideEULAPage>
        <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
        <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
        <HideLocalAccountScreen>true</HideLocalAccountScreen>
        <NetworkLocation>Work</NetworkLocation>
        <ProtectYourPC>3</ProtectYourPC>
      </OOBE>

      <!-- Création du compte local “utilisateur” (admin) -->
      <UserAccounts>
        <LocalAccounts>
          <LocalAccount wcm:action="add">
            <Name>utilisateur</Name>
            <Group>Administrators</Group>
            <Password>
              <!-- Laisser vide si tu veux sans mot de passe (local). 
                   Sinon mets une valeur. -->
              <Value></Value>
              <PlainText>true</PlainText>
            </Password>
            <DisplayName>utilisateur</DisplayName>
            <Description>Compte local AGDI</Description>
          </LocalAccount>
        </LocalAccounts>
      </UserAccounts>

      <!-- Auto-logon au premier démarrage -->
      <AutoLogon>
        <Enabled>true</Enabled>
        <Username>utilisateur</Username>
        <Password>
          <Value></Value>
          <PlainText>true</PlainText>
        </Password>
        <LogonCount>1</LogonCount>
      </AutoLogon>

      <!-- Commandes au premier logon -->
      <FirstLogonCommands>
        <!-- 1) Optionnel : désactiver le compte Administrateur intégré -->
        <SynchronousCommand wcm:action="add">
          <Order>1</Order>
          <Description>Désactive le compte Administrateur intégré</Description>
          <CommandLine>cmd /c net user administrateur /active:no</CommandLine>
        </SynchronousCommand>

        <!-- 2) Copier le contenu préparé vers le Bureau du nouvel utilisateur -->
        <SynchronousCommand wcm:action="add">
          <Order>2</Order>
          <Description>Copie des fichiers vers le Bureau utilisateur</Description>
          <CommandLine>cmd /c xcopy "C:\Deploy\Bureau\*" "C:\Users\utilisateur\Desktop\" /E /I /Y</CommandLine>
        </SynchronousCommand>

        <!-- 3) Nettoyer le dossier Deploy une fois copié -->
        <SynchronousCommand wcm:action="add">
          <Order>3</Order>
          <Description>Nettoyage du dossier Deploy</Description>
          <CommandLine>cmd /c rmdir /S /Q "C:\Deploy"</CommandLine>
        </SynchronousCommand>

        <!-- 4) (Facultatif) Lancer ton script AGDI post-install s’il existe -->
        <!--
        <SynchronousCommand wcm:action="add">
          <Order>4</Order>
          <Description>Script AGDI post-install</Description>
          <CommandLine>cmd /c "C:\Deploy\postinstall.cmd"</CommandLine>
        </SynchronousCommand>
        -->
      </FirstLogonCommands>
    </component>
  </settings>

  <!-- ============== META ============== -->
  <cpi:offlineImage cpi:source="wim://wimfile/Windows 10" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
