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

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

public class Line
{
    /// <summary>
    /// Bézier curve tension (0 for no Bézier curves).
    /// </summary>
    public int Tension { get; set; }

    /// <summary>
    /// Line fill color.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public string? BackgroundColor { get; set; }

    /// <summary>
    /// Line stroke width.
    /// </summary>
    public int BorderWidth { get; set; } = 1;

    /// <summary>
    /// Line stroke color.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public string? BorderColor { get; set; }

    /// <summary>
    /// Line cap style.
    /// </summary>
    public string BorderCapStyle { get; set; } = "butt";

    /// <summary>
    /// Line dash.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public int[]? BorderDash { get; set; }

    /// <summary>
    /// Line dash offset.
    /// </summary>
    public double BorderDashOffset { get; set; }

    /// <summary>
    /// Line join style.
    /// </summary>
    public BorderJoinStyle BorderJoinStyle { get; set; } = BorderJoinStyle.Miter;

    /// <summary>
    /// if true to keep Bézier control inside the chart, false for no restriction.
    /// </summary>
    public bool CapBezierPoints { get; set; } = true;

    /// <summary>
    /// Interpolation mode to apply.
    /// </summary>
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public string? CubicInterpolationMode { get; set; }

    /// <summary>
    /// How to fill the area under the line.
    /// </summary>
    public bool Fill { get; set; }

    /// <summary>
    /// if true to show the line as a stepped line (tension will be ignored).
    /// </summary>
    public bool Stepped { get; set; }
}
