namespace Hc900Crawler.Core.Application.DTOs;

/// <summary>
/// P&ID 관련 모든 API 응답의 공통 포맷입니다.
/// </summary>
public record PidResponse<T>
{
    public bool Success { get; init; }
    public T? Data { get; init; }
    public string? Error { get; init; }
    public string? Message { get; init; }

    public static PidResponse<T> Ok(T data, string message = "") => 
        new() { Success = true, Data = data, Message = message };

    public static PidResponse<T> Fail(string error, string message = "") =>
        new() { Success = false, Error = error, Message = message };
}

/// <summary>편집 엑셀 → pid_equipment UPSERT 결과.</summary>
public record PidImportResult
{
    public int SheetsProcessed { get; init; }
    public int RowsRead { get; init; }
    public int RowsUpdated { get; init; }
    public int RowsInserted { get; init; }
    public int Unmatched { get; init; }
    public List<string> UnmatchedTags { get; init; } = new();
}
