using CsvHelper.Configuration.Attributes;

namespace PowderCoating.Application.DTOs.Import;

/// <summary>
/// DTO for importing jobs from CSV files.
/// CustomerEmail is the preferred customer lookup key; CustomerName is used as a fallback
/// when the customer has no email address on file (the importer tries email first, then name).
/// </summary>
public class JobImportDto
{
    // "Job Number" = old export header (spaced); "JobNumber" = current header
    [Name("JobNumber", "Job Number")]
    public string? JobNumber { get; set; }

    // Optional — importer falls back to CustomerName when blank
    [Name("CustomerEmail")]
    public string? CustomerEmail { get; set; }

    // Fallback identifier when CustomerEmail is absent; matched against CompanyName
    [Name("CustomerName")]
    public string? CustomerName { get; set; }

    // Optional short label for the job (maps directly to Job.Description).
    // When blank, the system falls back to SpecialInstructions, then "Imported job".
    [Name("Description")]
    public string? Description { get; set; }

    [Name("Status")]
    public string Status { get; set; } = "Pending";

    [Name("Priority")]
    public string Priority { get; set; } = "Normal";

    [Name("ScheduledDate")]
    public DateTime? ScheduledDate { get; set; }

    // "Due Date" = old export header (spaced); "DueDate" = current header
    [Name("DueDate", "Due Date")]
    public DateTime? DueDate { get; set; }

    // "Final Price" = old export header (spaced); "FinalPrice" = current header
    [Name("FinalPrice", "Final Price")]
    public decimal? FinalPrice { get; set; }

    [Name("CustomerPO")]
    public string? CustomerPO { get; set; }

    [Name("SpecialInstructions")]
    public string? SpecialInstructions { get; set; }

    [Name("ProjectName")]
    public string? ProjectName { get; set; }

    [Name("Notes")]
    public string? Notes { get; set; }
}
