namespace PowderCoating.Application.DTOs.Company;
// ── Browse / card display ──────────────────────────────────────────────────
/// Lean DTO for the community library browse grid card.
public class FormulaLibraryCardDto
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public string OutputMode { get; set; } = "FixedRate";
public string? Tags { get; set; }
public string? IndustryHint { get; set; }
public string SourceCompanyName { get; set; } = string.Empty;
public int ImportCount { get; set; }
public DateTime SharedAt { get; set; }
public string? DiagramImagePath { get; set; }
/// Non-null when this formula was derived from another library entry.
public int? InspiredByFormulaLibraryItemId { get; set; }
public string? InspiredByName { get; set; }
public string? InspiredByCompanyName { get; set; }
/// True when the current company has already imported this entry.
public bool AlreadyImported { get; set; }
/// True when this formula was shared by the current browsing company.
public bool IsOwnFormula { get; set; }
/// Total thumbs-up votes across all companies.
public int ThumbsUp { get; set; }
/// Total thumbs-down votes across all companies.
public int ThumbsDown { get; set; }
/// The current browsing company's vote: true = up, false = down, null = no vote.
public bool? MyVote { get; set; }
}
// ── Full detail (import preview modal) ────────────────────────────────────
/// Full DTO used in the import preview modal — shows fields and formula.
public class FormulaLibraryDetailDto : FormulaLibraryCardDto
{
public string FieldsJson { get; set; } = "[]";
public string Formula { get; set; } = string.Empty;
public decimal? DefaultRate { get; set; }
public string? RateLabel { get; set; }
public string? Notes { get; set; }
public int FieldCount { get; set; }
}
// ── Share from Company Settings ───────────────────────────────────────────
/// Submitted when a company admin shares one of their templates to the community library.
public class ShareFormulaRequest
{
public int CustomItemTemplateId { get; set; }
public string? Tags { get; set; }
public string? IndustryHint { get; set; }
}
// ── Company Settings list view ─────────────────────────────────────────────
/// Status of a template relative to the community library, shown in Company Settings.
public class FormulaLibraryStatusDto
{
/// The FormulaLibraryItem Id, if this template has ever been shared.
public int? LibraryItemId { get; set; }
public bool IsPublished { get; set; }
/// Whether this template is eligible to be shared (original or modified import).
public bool CanShare { get; set; }
/// Set when this template was imported; the name of the original library entry.
public string? ImportedFromName { get; set; }
public string? ImportedFromCompany { get; set; }
}