70 lines
2.2 KiB
C#
70 lines
2.2 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Text.Json.Serialization;
|
|||
|
|
|||
|
namespace ParentalControlService {
|
|||
|
public struct Status
|
|||
|
{
|
|||
|
[JsonPropertyName("action")]
|
|||
|
public bool Action { get; set; }
|
|||
|
[JsonPropertyName("until")]
|
|||
|
public DateTime? Until { get; set; }
|
|||
|
[JsonPropertyName("then_until")]
|
|||
|
public DateTime? ThenUntil { get; set; }
|
|||
|
|
|||
|
public override bool Equals(object? obj) {
|
|||
|
return obj is Status other && Equals(other);
|
|||
|
}
|
|||
|
public readonly bool Equals(Status other) {
|
|||
|
return Action == other.Action && Until == other.Until && ThenUntil == other.ThenUntil;
|
|||
|
}
|
|||
|
public override readonly int GetHashCode() {
|
|||
|
return HashCode.Combine(Action, Until, ThenUntil);
|
|||
|
}
|
|||
|
public static bool operator ==(Status lhs, Status rhs) {
|
|||
|
return lhs.Action == rhs.Action && lhs.Until == rhs.Until && lhs.ThenUntil == rhs.ThenUntil;
|
|||
|
}
|
|||
|
public static bool operator !=(Status lhs, Status rhs) {
|
|||
|
return !(lhs == rhs);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public struct Schedule
|
|||
|
{
|
|||
|
[JsonPropertyName("start")]
|
|||
|
public string? Start { get; set; }
|
|||
|
[JsonPropertyName("end")]
|
|||
|
public string? End { get; set; }
|
|||
|
}
|
|||
|
|
|||
|
public struct Override
|
|||
|
{
|
|||
|
[JsonPropertyName("start")]
|
|||
|
public DateTime Start { get; set; }
|
|||
|
[JsonPropertyName("end")]
|
|||
|
public DateTime End { get; set; }
|
|||
|
[JsonPropertyName("action")]
|
|||
|
public bool Action { get; set; }
|
|||
|
}
|
|||
|
|
|||
|
public struct Data
|
|||
|
{
|
|||
|
[JsonPropertyName("status")]
|
|||
|
public Status Status { get; set; }
|
|||
|
[JsonPropertyName("schedules")]
|
|||
|
public Dictionary<int,List<Schedule>> Schedules { get; set; }
|
|||
|
[JsonPropertyName("overrides")]
|
|||
|
public List<Override> Overrides { get; set; }
|
|||
|
}
|
|||
|
|
|||
|
public struct Config
|
|||
|
{
|
|||
|
[JsonPropertyName("url")]
|
|||
|
public string Url { get; set; }
|
|||
|
[JsonPropertyName("username")]
|
|||
|
public string Username { get; set; }
|
|||
|
[JsonPropertyName("password")]
|
|||
|
public string Password { get; set; }
|
|||
|
}
|
|||
|
}
|