using TodoList.Core.Entities;
using System.Text.Json.Serialization;

namespace TodoList.Application.Models;

public class CreateTaskDto
{
    public string Title { get; set; } = string.Empty;

    [JsonConverter(typeof(JsonStringEnumConverter))]
    public TaskPriority Priority { get; set; } = TaskPriority.Medium;

    public int? ParentTaskId { get; set; }
}

public class UpdateTaskDto
{
    public int Id { get; set; }

    public string? Title { get; set; }

    [JsonConverter(typeof(JsonStringEnumConverter))]
    public TaskPriority? Priority { get; set; }
}

public class TaskDto
{
    public int Id { get; set; }
    public string Title { get; set; } = string.Empty;

    [JsonConverter(typeof(JsonStringEnumConverter))]
    public TaskPriority Priority { get; set; }

    public bool IsCompleted { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
    public int? ParentTaskId { get; set; }
    public List<TaskDto> SubTasks { get; set; } = new();
}

public class ApiResponse<T>
{
    public bool Success { get; set; }
    public T? Data { get; set; }
    public string Message { get; set; } = string.Empty;
    public List<string> Errors { get; set; } = new();
}
