namespace Berufsschule_HAM.Models;

using System.Text.Json;
using System.Text.Json.Serialization;
using Berufsschule_HAM.Exceptions;
public class LocationModel
{
    public required string Location { get; set; }
    public LocationsDescription? Description { get; set; }
    public LocationModel(Dictionary<string, string> ldapData)
    {
        Location = ldapData.GetValueOrDefault("l") ?? throw new LocationModelConfigurationException();
        string? descriptionValue = ldapData.GetValueOrDefault("description");
        if (descriptionValue is null)
        {
            Description = new();
        }
        else
        {
            Description = JsonSerializer.Deserialize<LocationsDescription>(descriptionValue);
        }
    }
}
public class LocationsDescription
{
    [JsonPropertyName("Location")]
    public string? Location { get; set; }
    [JsonPropertyName("RoomNumber")]
    public string? RoomNumber { get; set; }
    [JsonPropertyName("Seat")]
    public string? Seat { get; set; }
}

public class LocationTableViewModel
{
    public required string LocationID { get; set; }
    public required string LocationName { get; set; }
    public required string RoomNumber { get; set; }
    public required string Seat { get; set; }
}