namespace Civiti.Domain.Entities; public class Issue { public Guid Id { get; set; } public Guid UserId { get; set; } public string Title { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public IssueCategory Category { get; set; } public string Address { get; set; } = string.Empty; public double Latitude { get; set; } public double Longitude { get; set; } public string? District { get; set; } // District/Sector for Romanian administrative divisions public UrgencyLevel Urgency { get; set; } public IssueStatus Status { get; set; } = IssueStatus.Submitted; public int EmailsSent { get; set; } = 0; public int CommunityVotes { get; set; } = 0; public int ReportCount { get; set; } = 0; public bool IsFlagged { get; set; } = false; public string? DesiredOutcome { get; set; } public string? CommunityImpact { get; set; } public string? AdminNotes { get; set; } public string? RejectionReason { get; set; } public DateTime? ReviewedAt { get; set; } public string? ReviewedBy { get; set; } public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; // When the issue entered the Resolved state it is in now, for display ("Rezolvată acum N // zile"). Null whenever the issue is not Resolved — re-opening clears it, so it never // describes a resolution the issue has since backed out of. Deliberately not // ResolutionRewardedAt or ResolutionNotifiedAt: those are a once-per-issue latch and an // anti-spam cooldown respectively, so neither tracks the current resolution and both would // misreport it after a resolve/re-open lap. public DateTime? ResolvedAt { get; set; } // When the author's resolution reward (points, achievement progress, badges) was granted. // An author may resolve and re-open the same issue repeatedly; this makes that reward // once-per-issue rather than once-per-resolution, so the cycle cannot be farmed. Null for // issues resolved before this was introduced, which simply means the next resolve pays out. // Written only by a conditional claim in IssueService.UpdateIssueStatusAsync — never read // as a guard from an unlocked snapshot, because that is not a guard. public DateTime? ResolutionRewardedAt { get; set; } // When supporters were last told this issue was resolved. Resolving fans out a push and an // email to every voter and commenter, so — unlike the reward, which is once per issue for // good — this one is a cooldown rather than a latch: a genuine re-resolution months later // should reach the people following it, while a resolve/re-open loop must not be able to // mail them on every lap. See ResolutionNotifyCooldown. public DateTime? ResolutionNotifiedAt { get; set; } // Cached AI-composed petition argument core (see IPetitionBodyCacheStore). Nullable until // first generated. ContentHash is a fingerprint of the prompt-affecting issue fields, so an // edit that changes them invalidates the cache automatically; GeneratedAt drives the TTL. public string? PetitionBodyCore { get; set; } public string? PetitionBodyContentHash { get; set; } public DateTime? PetitionBodyGeneratedAt { get; set; } // Navigation properties public UserProfile User { get; set; } = null!; public List Photos { get; set; } = []; /// /// The author's "after" photos for the resolution this issue is currently in. Empty unless /// is . Kept out of /// on purpose — see . /// public List ResolutionPhotos { get; set; } = []; public List AdminActions { get; set; } = []; public List IssueAuthorities { get; set; } = []; public List Activities { get; set; } = []; public List Comments { get; set; } = []; public List Votes { get; set; } = []; } /// /// Categories for civic issues /// public enum IssueCategory { /// Roads, sidewalks, bridges Infrastructure, /// Parks, pollution, waste Environment, /// Public transport, traffic Transportation, /// Utilities, government services PublicServices, /// Crime, lighting, hazards Safety, /// Uncategorized issues Other } /// /// Urgency level of an issue /// public enum UrgencyLevel { /// Not specified Unspecified = 0, /// Can be addressed in normal course Low = 1, /// Should be addressed soon Medium = 2, /// Requires prompt attention High = 3, /// Immediate action required Urgent = 4 } /// /// Current status of an issue in the workflow /// public enum IssueStatus { /// Not specified Unspecified = 0, /// Saved as draft Draft = 1, /// Submitted for review Submitted = 2, /// Under admin review UnderReview = 3, /// Active and visible to public (admin approved) Active = 4, /// Issue resolved Resolved = 5, /// Rejected by admin Rejected = 6, /// Cancelled by user Cancelled = 7 }