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

namespace RobotNet.WebApp.Charts.Models.BarChart.Axes;

public class ChartAxes
{
    /// <summary>
    /// If true, scale will include 0 if it is not already included.
    /// </summary>
    public bool BeginAtZero { get; set; } = true;

    /// <summary>
    /// Define options for the border that run perpendicular to the axis.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public ChartAxesBorder? Border { get; set; }

    /// <summary>
    /// Gets or sets the grid configuration.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public ChartAxesGrid? Grid { get; set; }

    /// <summary>
    /// User defined maximum number for the scale, overrides maximum value from data.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public double? Max { get; set; }

    /// <summary>
    /// User defined minimum number for the scale, overrides minimum value from data.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public double? Min { get; set; }

    /// <summary>
    /// Should the data be stacked.
    /// By default data is not stacked.
    /// If the stacked option of the value scale (y-axis on horizontal chart) is true, positive and negative values are stacked
    /// separately.
    /// </summary>
    public bool Stacked { get; set; }

    /// <summary>
    /// Adjustment used when calculating the maximum data value.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public double? SuggestedMax { get; set; }

    /// <summary>
    /// Adjustment used when calculating the minimum data value.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public double? SuggestedMin { get; set; }

    /// <summary>
    /// Gets or sets the tick configuration.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public ChartAxesTicks? Ticks { get; set; }

    /// <summary>
    /// Gets or sets the title configuration.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public ChartAxesTitle? Title { get; set; }

    /// <summary>
    /// Gets or sets the index scale type. />.
    /// </summary>
    /// <remarks>
    /// Default value is <see langword="null" />.
    /// </remarks>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public ChartAxesType? Type { get; set; } = null;

    /// <summary>
    /// The weight used to sort the axis. Higher weights are further away from the chart area.
    /// </summary>
    public int? Weight { get; set; }

    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public TitlePosition? Position { get; set; }
}

