namespace PowderCoating.Core.Entities; /// /// Company-specific application and workflow preferences /// public class CompanyPreferences : BaseEntity { public int CompanyId { get; set; } // Application Defaults public string DefaultCurrency { get; set; } = "USD"; public string DefaultDateFormat { get; set; } = "MM/dd/yyyy"; public string DefaultTimeFormat { get; set; } = "12h"; public string DefaultPaymentTerms { get; set; } = "Net 30"; public int DefaultQuoteValidityDays { get; set; } = 30; public string QuoteNumberPrefix { get; set; } = "QT"; public string JobNumberPrefix { get; set; } = "JOB"; public string InvoiceNumberPrefix { get; set; } = "INV"; public bool UseMetricSystem { get; set; } = false; // False = Imperial (ft, lb), True = Metric (m, kg) // Job / Workflow Defaults public string DefaultJobPriority { get; set; } = "Normal"; public bool RequireCustomerPO { get; set; } = false; public bool AllowCustomerApproval { get; set; } = true; public int DefaultTurnaroundDays { get; set; } = 7; // Email Sender Identity /// From address used in outgoing emails. Falls back to SendGrid:FromEmail in appsettings when null. public string? EmailFromAddress { get; set; } /// From display name used in outgoing emails. Falls back to SendGrid:FromName in appsettings when null. public string? EmailFromName { get; set; } // Notifications & Alerts public bool EmailNotificationsEnabled { get; set; } = true; public bool NotifyOnNewJob { get; set; } = true; public bool NotifyOnNewQuote { get; set; } = true; public bool NotifyOnJobStatusChange { get; set; } = true; public bool NotifyOnQuoteApproval { get; set; } = true; public bool NotifyOnPaymentReceived { get; set; } = true; public int QuoteExpiryWarningDays { get; set; } = 3; public int DueDateWarningDays { get; set; } = 2; public int MaintenanceAlertDays { get; set; } = 7; // Payment Reminders /// When true, the background service will send overdue payment reminder emails. public bool PaymentRemindersEnabled { get; set; } = false; /// Comma-separated days-past-due thresholds at which reminders are sent (e.g. "7,14,30"). public string PaymentReminderDays { get; set; } = "7,14,30"; // Data Retention public int QuoteRetentionYears { get; set; } = 7; public int JobRetentionYears { get; set; } = 7; public int LogRetentionDays { get; set; } = 90; public int AutoArchiveJobsDays { get; set; } = 365; public int DeletedRecordRetentionDays { get; set; } = 30; // Quote PDF Template public string QtAccentColor { get; set; } = "#374151"; public string? QtDefaultTerms { get; set; } public string? QtFooterNote { get; set; } // Invoice PDF Template public string InAccentColor { get; set; } = "#374151"; public string? InDefaultTerms { get; set; } public string? InFooterNote { get; set; } // Blank Work Order PDF Template public string WoAccentColor { get; set; } = "#374151"; public string? WoTerms { get; set; } // Setup Wizard Progress public bool SetupWizardStarted { get; set; } = false; public bool SetupWizardCompleted { get; set; } = false; /// Comma-separated step numbers that have been completed (e.g. "1,2,3") public string? SetupWizardDoneSteps { get; set; } /// Comma-separated step numbers the user chose to skip public string? SetupWizardSkippedSteps { get; set; } /// UTC timestamp of when the setup wizard was completed. Null if not yet completed. public DateTime? SetupWizardCompletedAt { get; set; } /// ASP.NET Identity user ID of the user who completed the setup wizard. public string? SetupWizardCompletedByUserId { get; set; } /// Display name of the user who completed the setup wizard, stored at completion time /// to avoid a runtime JOIN to the Identity tables when listing companies. public string? SetupWizardCompletedByName { get; set; } /// True when the company indicated they are migrating data from QuickBooks Desktop. public bool MigratingFromQuickBooks { get; set; } = false; /// JSON blob persisting QB Migration Wizard step state across sessions. public string? QbMigrationStateJson { get; set; } // Kiosk settings /// /// Controls what the kiosk creates on submission: "Quote" (default) or "Job". /// Quote aligns with the default Terms text ("subject to a formal quote"). /// Job is for shops that price on the spot and want the work order ready immediately. /// public string KioskIntakeOutput { get; set; } = "Quote"; // Guided activation / first-workflow onboarding /// Selected first-workflow path: quote_first or job_first. Null until chosen. public string? OnboardingPath { get; set; } /// True once the company completes its first guided real workflow. public bool FirstWorkflowCompleted { get; set; } = false; /// UTC timestamp of when the first guided workflow was completed. public DateTime? FirstWorkflowCompletedAt { get; set; } /// UTC timestamp of the company's first quote creation. public DateTime? FirstQuoteCreatedAt { get; set; } /// UTC timestamp of the company's first job creation. public DateTime? FirstJobCreatedAt { get; set; } /// UTC timestamp of the company's first invoice creation. public DateTime? FirstInvoiceCreatedAt { get; set; } /// UTC timestamp of when the company dismissed guided activation without completing it. public DateTime? GuidedActivationDismissedAt { get; set; } // Navigation public virtual Company Company { get; set; } = null!; }