42 lines
2.1 KiB
C#
42 lines
2.1 KiB
C#
using System;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace perubahan;
|
|
internal partial record Agent(string AgentID, string Name, string Jabatan, short DeplID, string SKAngkat, DateOnly TMT, string? SKPerb, DateOnly? TMUbah, string? Vision, string? Mission, string? PhotoURL);
|
|
internal partial record ApiResponse(int Status, string Message, object Data);
|
|
internal partial record Deployment(short DeplID, string UnitKerja);
|
|
internal partial record LoginUser(string Username, string Password);
|
|
internal partial record PasswdUser(string Username, string PlainPassword);
|
|
internal partial record SafeUser(string Username, string Name, byte Level, bool Active) {
|
|
internal static SafeUser FromUser(User Source)
|
|
{
|
|
return new(Source.Username, Source.Name, Source.Level, Source.Active);
|
|
}
|
|
};
|
|
internal partial record SimpleApiResponse(int Status, string Message);
|
|
internal partial record User(string Username, string Name, string Password, byte Level, bool Active);
|
|
[JsonSerializable(typeof(Agent))]
|
|
[JsonSerializable(typeof(ApiResponse))]
|
|
[JsonSerializable(typeof(Deployment))]
|
|
[JsonSerializable(typeof(JsonElement))]
|
|
[JsonSerializable(typeof(JsonElement[]))]
|
|
[JsonSerializable(typeof(LoginUser))]
|
|
[JsonSerializable(typeof(PasswdUser))]
|
|
[JsonSerializable(typeof(SafeUser))]
|
|
[JsonSerializable(typeof(SimpleApiResponse))]
|
|
[JsonSerializable(typeof(User))]
|
|
//////////----------DICTIONARIES----------//////////
|
|
[JsonSerializable(typeof(Dictionary<string, JsonElement>))]
|
|
//////////-------------LISTS--------------//////////
|
|
[JsonSerializable(typeof(List<Agent>))]
|
|
[JsonSerializable(typeof(List<Deployment>))]
|
|
[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Default, PropertyNameCaseInsensitive = true, PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)]
|
|
internal partial class SGContext : JsonSerializerContext { }
|
|
|
|
internal static partial class Regices
|
|
{
|
|
[GeneratedRegex(@"data:image/(?<format>.+?);base64,(?<data>.+)")]
|
|
internal static partial Regex Base64Regex();
|
|
} |