module ItsGenCert_TypeAndValues {
    
    // LibIts
    import from IEEE1609dot2BaseTypes language "ASN.1:1997" all;
    import from IEEE1609dot2 language "ASN.1:1997" all;
    import from EtsiTs103097Module language "ASN.1:1997" all;
    
    const Time64 c_its_epoch := 1072911600000;
    /**
     * @desc Start date/time in milliseconds
     * @remark See https://www/epochconverter.com/
     */
    const Time32 c_2018_01_01_gmt_paris := 1514764800;
    const Time32 c_2020_01_01_gmt_paris := 1577836800;
    const Time32 c_2010_01_01_gmt_paris := 1262304000;
    /**
     * @desc Six months duration
     */
    const Duration c_six_months := { hours := 6 * 30 * 24 };
    /**
     * @desc One year duration
     */
    const Duration c_one_year := { years := 1 };    
    /**
     * @desc CA application permissions
     */
    const PsidSsp c_appPermissions_cam  := { psid := 36, ssp := { bitmapSsp := '830001'O } };
    /**
     * @desc DENM application permissions
     */
    const PsidSsp c_appPermissions_denm := { psid := 37, ssp := { bitmapSsp := '830001'O } };
    /**
     * @desc GeoNetworking application permissions
     */
    const PsidSsp c_appPermissions_mgmt := { psid := 141, ssp := { bitmapSsp := '830001'O } };
    // TODO Add MAPEM/SPATEM/POI/IS
    
    /**
     * @desc This record contains, for each certificate, the parameters to generate it
     */
    type record certificate_params {
      charstring              certificate_id,
      GeographicRegion        region optional,
      ValidityPeriod          validity_period,
      SequenceOfPsidSsp       app_permissions optional,
      SequenceOfPsidSspRange  issuing_permissions optional,
      HashAlgorithm           hash_algorithm,
      Curve                   curve,
      charstring              signed_by
    } // End of type certificate_params
    type record of certificate_params certificate_params_list;
    
    type enumerated Curve {
      e_nist_p256,
      e_brainpool_p256,
      e_brainpool_p384
    } // End of type Curve
    
    type record certificate_details {
      charstring                certificate_id,
      EtsiTs103097Certificate   certificate,
      octetstring               enc_cert,
      octetstring               private_key,
      octetstring               public_key_x,
      octetstring               public_key_y,
      HashedId8                 hashid8,
      HashedId8                 issuer
    } // End of type certificate_details
    type record of certificate_details certificate_details_list;
    
} // End of module ItsGenCert_TypeAndValues

