using RobotNet.WebApp.Charts.Models.Common.Elements;
using System.Text.Json.Serialization;

namespace RobotNet.WebApp.Charts.Models.Common;

public class ChartOptions : IChartOptions
{
    /// <summary>
    /// Gets or sets the locale.
    /// By default, the chart is using the default locale of the platform which is running on.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public string? Locale { get; set; }

    /// <summary>
    /// Gets or sets a value indicating whether to maintain the original canvas aspect ratio (width / height) when resizing.
    /// </summary>
    /// <remarks>
    /// Default value is <see langword="true" />.
    /// </remarks>
    public bool MaintainAspectRatio { get; set; } = true;

    /// <summary>
    /// Gets or sets a value indicating whether the chart canvas should be resized when its container is.
    /// </summary>
    /// <remarks>
    /// Default value is <see langword="false" />.
    /// </remarks>
    public bool Responsive { get; set; }

    /// <summary>
    /// Gets or sets the canvas aspect ratio (i.e. width / height, a value of 1 representing a square canvas).
    /// <para>Note that this option is ignored if the height is explicitly defined either as attribute (of the canvas) or via the style.</para>
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public double? AspectRatio { get; set; }

    /// <summary>
    /// Gets or sets the duration in milliseconds it takes to animate to new size after a resize event.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public int? ResponsiveAnimationDuration { get; set; }

    /// <summary>
    /// Gets or sets the animation-configuration for this chart.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public ChartAnimation? Animation { get; set; }

    /// <summary>
    /// Gets or sets the layout options for this chart.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public ChartLayout? Layout { get; set; }

    /// <summary>
    /// Gets or sets the Interaction configuration for this chart.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public Interaction? Interaction { get; set; }

    /// <summary>
    /// Gets or sets the elements options for this chart.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public ChartElements? Elements { get; set; }
}
