using RobotNet.WebApp.Charts.Enums;
using System.Text.Json.Serialization;

namespace RobotNet.WebApp.Charts.Models.Common.Plugins;

public class ChartPluginsLegend
{
    /// <summary>
    /// Alignment of the legend. Default values is 'center'. Other possible values 'start' and 'end'.
    /// </summary>
    public LegendAlignment Align { get; set; } = LegendAlignment.Center;

    /// <summary>
    /// Is the legend shown? Default value is 'true'.
    /// </summary>
    public bool Display { get; set; } = true;

    /// <summary>
    /// If <see langword="true" />, Marks that this box should take the full width/height of the canvas (moving other boxes). This is unlikely to need to be changed in day-to-day use.
    /// </summary>
    public bool FullSize { get; set; } = true;

    /// <summary>
    /// Label settings for the legend.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public ChartPluginsLegendLabels? Labels { get; set; }

    /// <summary>
    /// Maximum height of the legend, in pixels.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public int? MaxHeight { get; set; }

    /// <summary>
    /// Maximum width of the legend, in pixels.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public int? MaxWidth { get; set; }

    /// <summary>
    /// Position of the legend. Default value is 'top'. Other possible value is 'bottom'.
    /// </summary>
    public LegendPosition Position { get; set; } = LegendPosition.Top;

    /// <summary>
    /// If <see langword="true" />, the Legend will show datasets in reverse order.
    /// </summary>
    public bool Reverse { get; set; } = false;

    /// <summary>
    /// If <see langword="true" />, for rendering of the legends will go from right to left.
    /// </summary>
    public bool Rtl { get; set; } = false;

    /// <summary>
    /// This will force the text direction 'rtl' or 'ltr' on the canvas for rendering the legend, regardless of the css specified on the canvas
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public string? TextDirection { get; set; }

    /// <summary>
    /// Title object
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public ChartPluginsLegendTitle? Title { get; set; }
}
