using adas_core.Domain.Enums;

namespace adas_core.Domain.Models.GroupedObservations;

public class GroupedField
{
    public GroupedField()
    {
    }

    public GroupedField(
        string? name,
        List<string>? names,
        string? group,
        List<string>? startTimeShift,
        int max,
        GroupedObservationEnum.Regularity? regularity,
        GroupedObservationEnum.Since since,
        List<GroupedObservationEnum.Result>? result,
        List<string>? labelList)
    {
        Name = name;
        Names = names ?? [];
        Group = group;
        StartTimeShift = startTimeShift ?? [];
        Max = max;
        Regularity = regularity;
        Since = since;
        Result = result ?? [GroupedObservationEnum.Result.First];
        LabelList = labelList;
    }

    public string? Name { get; init; }

    public List<string> Names { get; init; } = [];

    public string? Group { get; init; }

    public List<string> StartTimeShift { get; init; } = [];

    public int Max { get; init; }

    public GroupedObservationEnum.Regularity? Regularity { get; init; }

    public GroupedObservationEnum.Since Since { get; init; }

    public List<GroupedObservationEnum.Result> Result { get; init; } = [];

    public List<string>? LabelList { get; init; }

    public List<string> GetNames()
    {
        return Names;
    }

    public override bool Equals(object? obj)
    {
        return obj is GroupedField field && Group == field.Group;
    }

    public override int GetHashCode()
    {
        return HashCode.Combine(Name, Group, Max, Regularity, Result);
    }
}