using System; namespace JobTrackerApi.Models { public class JobApplication { public int Id { get; set; } public string? OwnerUserId { get; set; } public string JobTitle { get; set; } = ""; public int CompanyId { get; set; } public Company Company { get; set; } = null!; public string Status { get; set; } = "Applied"; public DateTime DateApplied { get; set; } = DateTime.UtcNow; public string? Location { get; set; } public string? Salary { get; set; } // Structured salary; the free-text Salary field is kept for display/back-compat. public decimal? SalaryMin { get; set; } public decimal? SalaryMax { get; set; } public string? SalaryCurrency { get; set; } // e.g. "NOK", "GBP", "EUR" public string? SalaryPeriod { get; set; } // "year" | "month" | "hour" public string? NextAction { get; set; } public DateTime? FollowUpAt { get; set; } public DateTime? FeedbackRequestedAt { get; set; } public string? RecruiterMessageDraft { get; set; } // Attachment checklist. Derived from Attachment rows, not directly settable by API // consumers -- see AttachmentsController.RecomputeAttachmentFlagsAsync, the single place // these are written, so they can't drift from what's actually attached. public bool HasResume { get; set; } = false; public bool HasCoverLetter { get; set; } = false; public bool HasPortfolio { get; set; } = false; public bool HasOtherAttachment { get; set; } = false; // Soft delete: hide from default queries without losing history. public bool IsDeleted { get; set; } = false; public DateTime? DeletedAt { get; set; } public bool ResponseReceived { get; set; } = false; public DateTime? ResponseDate { get; set; } public string? Notes { get; set; } public string? CoverLetterText { get; set; } public string? JobUrl { get; set; } // Imported job content public string? Description { get; set; } public string? TranslatedDescription { get; set; } public string? DescriptionLanguage { get; set; } // "en", "no", ... public string? Tags { get; set; } // JSON array string, e.g. ["Azure","Docker"] public DateTime? Deadline { get; set; } // Short summary generated at creation time and persisted to avoid repeated model calls. public string? ShortSummary { get; set; } public string? TailoredCvText { get; set; } public DateTime? TailoredCvUpdatedAt { get; set; } public DateTime? LastReminderEmailSentAt { get; set; } public TailoredCvDraft? TailoredCvDraft { get; set; } public List Messages { get; set; } = new(); public List Attachments { get; set; } = new(); public List Events { get; set; } = new(); public int DaysSince => ((ResponseReceived ? (ResponseDate ?? DateTime.UtcNow) : DateTime.UtcNow) - DateApplied.ToUniversalTime()).Days; } }