using PowderCoating.Core.Enums;
using System.ComponentModel.DataAnnotations;

namespace PowderCoating.Application.DTOs.Accounting;

public class ExpenseListDto
{
    public int Id { get; set; }
    public string ExpenseNumber { get; set; } = string.Empty;
    public DateTime Date { get; set; }
    public int? VendorId { get; set; }
    public string? VendorName { get; set; }
    public int ExpenseAccountId { get; set; }
    public string ExpenseAccountName { get; set; } = string.Empty;
    public string ExpenseAccountNumber { get; set; } = string.Empty;
    public int PaymentAccountId { get; set; }
    public string PaymentAccountName { get; set; } = string.Empty;
    public PaymentMethod PaymentMethod { get; set; }
    public decimal Amount { get; set; }
    public string? Memo { get; set; }
    public int? JobId { get; set; }
    public string? JobNumber { get; set; }
    public bool HasReceipt { get; set; }
}

public class ExpenseDto : ExpenseListDto
{
    public string? ReceiptFilePath { get; set; }
    public DateTime CreatedAt { get; set; }
}

public class CreateExpenseDto
{
    [Required]
    public DateTime Date { get; set; } = DateTime.Today;

    public int? VendorId { get; set; }

    [Required]
    public int ExpenseAccountId { get; set; }

    [Required]
    public int PaymentAccountId { get; set; }

    public int? JobId { get; set; }

    [Required]
    public PaymentMethod PaymentMethod { get; set; }

    [Required, Range(0.01, double.MaxValue, ErrorMessage = "Amount must be greater than zero")]
    public decimal Amount { get; set; }

    [MaxLength(500)]
    public string? Memo { get; set; }

    public string? ReceiptFilePath { get; set; }
}

public class EditExpenseDto : CreateExpenseDto
{
    public int Id { get; set; }
}
