using Monitoring.Core.Domain.UserPrimitives;
using Monitoring.Core.Domain.AssetGroupManagement;

namespace Monitoring.Core.Domain.UserSettingsManagement;

public class UserSettings
{
    public required UserSettingsId Id { get; set; }
    public required UserId UserId { get; set; }
    public required PositioningStrategy PositioningStrategy { get; set; }
    public ManualPosition? ManualPosition { get; set; }
    public AssetGroupId? AssetGroupId { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }

    private UserSettings() { }

    public static UserSettings Create(
        UserId userId,
        PositioningStrategy positioningStrategy,
        ManualPosition? manualPosition = null,
        AssetGroupId? assetGroupId = null)
    {
        return new UserSettings
        {
            Id = UserSettingsId.Create(),
            UserId = userId,
            PositioningStrategy = positioningStrategy,
            ManualPosition = manualPosition,
            AssetGroupId = assetGroupId,
            CreatedAt = DateTime.UtcNow,
            UpdatedAt = DateTime.UtcNow
        };
    }

    public void Update(
        PositioningStrategy positioningStrategy,
        ManualPosition? manualPosition = null,
        AssetGroupId? assetGroupId = null)
    {
        PositioningStrategy = positioningStrategy;
        ManualPosition = manualPosition;
        AssetGroupId = assetGroupId;
        UpdatedAt = DateTime.UtcNow;
    }
} 