using System;
using System.ComponentModel;
using System.Text.Json.Serialization;
using CommunityToolkit.Mvvm.ComponentModel;

namespace TodoList.Models
{
    public enum TodoPriority
    {
        [Description("低")]
        Low,
        [Description("中")]
        Medium,
        [Description("高")]
        High
    }

    public enum SyncStatus
    {
        Synced,
        Pending,
        Failed
    }

    public enum SortBy
    {
        [Description("创建时间")]
        CreatedAt,
        [Description("完成时间")]
        CompletedAt,
        [Description("优先级")]
        Priority
    }

    public enum SortOrder
    {
        [Description("升序")]
        Ascending,
        [Description("降序")]
        Descending
    }

    public partial class TodoItem : ObservableObject
    {
        [ObservableProperty]
        [property: SQLite.PrimaryKey]
        private string id = Guid.NewGuid().ToString();

        [ObservableProperty]
        private string content = string.Empty;

        [ObservableProperty]
        private bool isCompleted;

        [ObservableProperty]
        private TodoPriority priority = TodoPriority.Medium;

        [ObservableProperty]
        private DateTime createdAt = DateTime.Now;

        [ObservableProperty]
        private DateTime? completedAt;

        [ObservableProperty]
        private SyncStatus syncStatus = SyncStatus.Pending;
    }
}
