#nullable enable
using Baya.Domain.Common;

namespace Baya.Domain.Entities.Configuration;

/// <summary>
/// A typed key-value runtime business parameter (commission rate, VAT, deadlines…). The app parses
/// <see cref="Value"/> according to <see cref="DataType"/>. Every change is audited (the type implements
/// <see cref="IAuditable"/>); there is no soft-delete — configs are updated in place and the audit trail
/// is their history.
/// </summary>
public class PlatformConfig : BaseEntity<long>, IAuditable
{
    public string Key { get; set; } = string.Empty;

    public string Value { get; set; } = string.Empty;

    public string DataType { get; set; } = ConfigDataType.String;

    public string? Description { get; set; }
}

/// <summary>Stable codes for <see cref="PlatformConfig.DataType"/> — tells the app how to parse the raw value.</summary>
public static class ConfigDataType
{
    public const string Decimal = "decimal";
    public const string Int = "int";
    public const string Bool = "bool";
    public const string String = "string";
    public const string Json = "json";
}
