/*
 * Copyright (C) 2007-2024 C# Port
 * Original Copyright (C) 2007-2018 Siemens AG
 *
 * Iso1EXIDocument - 1:1 replica of VC2022 iso1EXIDocument structure
 * Enables exact debugging comparison between VC2022 and C#
 */

using V2GDecoderNet.V2G;

namespace V2GDecoderNet.EXI
{
    /// <summary>
    /// 1:1 replica of VC2022's struct iso1EXIDocument
    /// This enables exact debugging comparison and identical call sequences
    /// </summary>
    public class Iso1EXIDocument
    {
        // Core V2G_Message - this is what we actually use for CurrentDemandReq
        public bool V2G_Message_isUsed { get; set; }
        public V2GMessageExact V2G_Message { get; set; } = new V2GMessageExact();
        
        // Other document types (mostly unused, but kept for compatibility)
        public bool ServiceDiscoveryReq_isUsed { get; set; }
        public bool ServiceDiscoveryRes_isUsed { get; set; }
        public bool MeteringReceiptReq_isUsed { get; set; }
        public bool PaymentDetailsReq_isUsed { get; set; }
        public bool MeteringReceiptRes_isUsed { get; set; }
        public bool PaymentDetailsRes_isUsed { get; set; }
        public bool SessionSetupReq_isUsed { get; set; }
        public bool SessionSetupRes_isUsed { get; set; }
        public bool CableCheckReq_isUsed { get; set; }
        public bool CableCheckRes_isUsed { get; set; }
        public bool CertificateInstallationReq_isUsed { get; set; }
        public bool CertificateInstallationRes_isUsed { get; set; }
        public bool WeldingDetectionReq_isUsed { get; set; }
        public bool WeldingDetectionRes_isUsed { get; set; }
        public bool CertificateUpdateReq_isUsed { get; set; }
        public bool CertificateUpdateRes_isUsed { get; set; }
        public bool PaymentServiceSelectionReq_isUsed { get; set; }
        public bool PowerDeliveryReq_isUsed { get; set; }
        public bool PaymentServiceSelectionRes_isUsed { get; set; }
        public bool PowerDeliveryRes_isUsed { get; set; }
        public bool ChargingStatusReq_isUsed { get; set; }
        public bool ChargingStatusRes_isUsed { get; set; }
        public bool BodyElement_isUsed { get; set; }
        public bool CurrentDemandReq_isUsed { get; set; }
        public bool PreChargeReq_isUsed { get; set; }
        public bool CurrentDemandRes_isUsed { get; set; }
        public bool PreChargeRes_isUsed { get; set; }
        public bool AuthorizationReq_isUsed { get; set; }
        public bool AuthorizationRes_isUsed { get; set; }
        public bool ChargeParameterDiscoveryReq_isUsed { get; set; }
        public bool ChargeParameterDiscoveryRes_isUsed { get; set; }
        public bool ServiceDetailReq_isUsed { get; set; }
        public bool ServiceDetailRes_isUsed { get; set; }
        public bool SessionStopReq_isUsed { get; set; }
        public bool SessionStopRes_isUsed { get; set; }
        
        // Additional document-level fields that might be used for EXI processing
        // These correspond to various EXI fragment types in the original structure
        public bool AC_EVChargeParameter_isUsed { get; set; }
        public bool AC_EVSEChargeParameter_isUsed { get; set; }
        public bool AC_EVSEStatus_isUsed { get; set; }
        public bool DC_EVChargeParameter_isUsed { get; set; }
        public bool DC_EVPowerDeliveryParameter_isUsed { get; set; }
        public bool DC_EVSEChargeParameter_isUsed { get; set; }
        public bool DC_EVSEStatus_isUsed { get; set; }
        public bool DC_EVStatus_isUsed { get; set; }
        
        // XML Digital Signature related fields (for completeness)
        public bool Signature_isUsed { get; set; }
        public bool SignedInfo_isUsed { get; set; }
        public bool SignatureValue_isUsed { get; set; }
        public bool KeyInfo_isUsed { get; set; }
        public bool DigestValue_isUsed { get; set; }
        public bool KeyName_isUsed { get; set; }
        public bool MgmtData_isUsed { get; set; }
        
        /// <summary>
        /// Initialize document structure - equivalent to init_iso1EXIDocument()
        /// </summary>
        public void Initialize()
        {
            // Reset all _isUsed flags to false (VC2022 behavior)
            V2G_Message_isUsed = false;
            ServiceDiscoveryReq_isUsed = false;
            ServiceDiscoveryRes_isUsed = false;
            MeteringReceiptReq_isUsed = false;
            PaymentDetailsReq_isUsed = false;
            MeteringReceiptRes_isUsed = false;
            PaymentDetailsRes_isUsed = false;
            SessionSetupReq_isUsed = false;
            SessionSetupRes_isUsed = false;
            CableCheckReq_isUsed = false;
            CableCheckRes_isUsed = false;
            CertificateInstallationReq_isUsed = false;
            CertificateInstallationRes_isUsed = false;
            WeldingDetectionReq_isUsed = false;
            WeldingDetectionRes_isUsed = false;
            CertificateUpdateReq_isUsed = false;
            CertificateUpdateRes_isUsed = false;
            PaymentServiceSelectionReq_isUsed = false;
            PowerDeliveryReq_isUsed = false;
            PaymentServiceSelectionRes_isUsed = false;
            PowerDeliveryRes_isUsed = false;
            ChargingStatusReq_isUsed = false;
            ChargingStatusRes_isUsed = false;
            BodyElement_isUsed = false;
            CurrentDemandReq_isUsed = false;
            PreChargeReq_isUsed = false;
            CurrentDemandRes_isUsed = false;
            PreChargeRes_isUsed = false;
            AuthorizationReq_isUsed = false;
            AuthorizationRes_isUsed = false;
            ChargeParameterDiscoveryReq_isUsed = false;
            ChargeParameterDiscoveryRes_isUsed = false;
            ServiceDetailReq_isUsed = false;
            ServiceDetailRes_isUsed = false;
            SessionStopReq_isUsed = false;
            SessionStopRes_isUsed = false;
            
            AC_EVChargeParameter_isUsed = false;
            AC_EVSEChargeParameter_isUsed = false;
            AC_EVSEStatus_isUsed = false;
            DC_EVChargeParameter_isUsed = false;
            DC_EVPowerDeliveryParameter_isUsed = false;
            DC_EVSEChargeParameter_isUsed = false;
            DC_EVSEStatus_isUsed = false;
            DC_EVStatus_isUsed = false;
            
            Signature_isUsed = false;
            SignedInfo_isUsed = false;
            SignatureValue_isUsed = false;
            KeyInfo_isUsed = false;
            DigestValue_isUsed = false;
            KeyName_isUsed = false;
            MgmtData_isUsed = false;
            
            // Initialize V2G_Message structure
            V2G_Message = new V2GMessageExact();
        }
    }
}