using System;
#if WASM
   using CommonHelpers.WASM;
   using BookRegistry.Client.DB;
namespace BookRegistry.Client {
#else // !WASM:
   using CommonHelpers;
   using BookRegistry.Server.DB;
namespace BookRegistry.Server {
#endif // !WASM
//==================================================================================================

public class GeneratedToken_Info: ApiPropertiesBase
{
   public string EncodedJwt {
      get => Get( NEncodedJwt );
      set => NEncodedJwt = value; } internal string? NEncodedJwt;

   public string IdentityName {
      get => Get( NIdentityName );
      set => NIdentityName = value; } internal string? NIdentityName;

   public string RoleName {
      get => Get( NRoleName );
      set => NRoleName = value; } internal string? NRoleName;

   public DateTime ExpirationUtc {
      get => Value( NExpirationUtc );
      set => NExpirationUtc = value; } internal DateTime? NExpirationUtc;

#if SERVER
   internal GeneratedToken_Info( string userName, string roleName,
                                 bool refreshTokenType = false )
   : this( JWT.Generate( userName, roleName, refreshTokenType ) )
   {}
   GeneratedToken_Info( JwtInfo info )
   {
      EncodedJwt = info.EncodedJwt;
      IdentityName = info.IdentityName;
      RoleName = info.RoleName;
      ExpirationUtc = info.ExpirationUtc;
   }
#endif // SERVER
} // GeneratedToken_Info

//==================================================================================================
} // BookRegistry.Client/Server
