cat > OpcTestClient.Config.xml << 'EOF'
<?xml version="1.0" encoding="utf-8"?>
<ApplicationConfiguration
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:ua="http://opcfoundation.org/UA/2008/02/Types.xsd"
  xmlns="http://opcfoundation.org/UA/SDK/Configuration.xsd">
  
  <ApplicationName>OPC Test Client</ApplicationName>
  <ApplicationUri>urn:localhost:OpcTestClient</ApplicationUri>
  <ApplicationType>Client_1</ApplicationType>

  <SecurityConfiguration>
    <ApplicationCertificate>
      <StoreType>Directory</StoreType>
      <StorePath>%CommonApplicationData%/OPC Foundation/pki/own</StorePath>
      <SubjectName>CN=OPC Test Client</SubjectName>
    </ApplicationCertificate>
    
    <TrustedPeerCertificates>
      <StoreType>Directory</StoreType>
      <StorePath>%CommonApplicationData%/OPC Foundation/pki/trusted</StorePath>
    </TrustedPeerCertificates>

    <RejectedCertificateStore>
      <StoreType>Directory</StoreType>
      <StorePath>%CommonApplicationData%/OPC Foundation/pki/rejected</StorePath>
    </RejectedCertificateStore>

    <AutoAcceptUntrustedCertificates>true</AutoAcceptUntrustedCertificates>
  </SecurityConfiguration>

  <TransportQuotas>
    <OperationTimeout>600000</OperationTimeout>
    <MaxStringLength>1048576</MaxStringLength>
    <MaxByteStringLength>1048576</MaxByteStringLength>
    <MaxArrayLength>65536</MaxArrayLength>
    <MaxMessageSize>4194304</MaxMessageSize>
    <MaxBufferSize>65536</MaxBufferSize>
    <ChannelLifetime>300000</ChannelLifetime>
    <SecurityTokenLifetime>3600000</SecurityTokenLifetime>
  </TransportQuotas>

  <ClientConfiguration>
    <DefaultSessionTimeout>60000</DefaultSessionTimeout>
    <MinSubscriptionLifetime>10000</MinSubscriptionLifetime>
  </ClientConfiguration>

  <TraceConfiguration>
    <OutputFilePath>OpcTest.log</OutputFilePath>
    <DeleteOnLoad>true</DeleteOnLoad>
  </TraceConfiguration>
</ApplicationConfiguration>
EOF

echo "✅ Config file created!"