// using System; using GreenHome.Infrastructure.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace GreenHome.Infrastructure.Data.Migrations.Postgres { [DbContext(typeof(PostgresGreenHomeDbContext))] partial class PostgresGreenHomeDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "9.0.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("GreenHome.Domain.AIProfile", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ApiKey") .IsRequired() .HasMaxLength(500) .HasColumnType("character varying(2000)"); b.Property("BalanceCurrency") .HasMaxLength(10) .HasColumnType("character varying(40)"); b.Property("BalanceUpdatedAt") .HasColumnType("timestamp with time zone"); b.Property("BalanceUsd") .HasColumnType("decimal(18,6)"); b.Property("BaseUrl") .IsRequired() .HasMaxLength(300) .HasColumnType("character varying(1200)"); b.Property("CompletionPricePer1M") .HasColumnType("decimal(18,6)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("MaxTokens") .HasColumnType("integer"); b.Property("Model") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("Name") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("PromptPricePer1M") .HasColumnType("decimal(18,6)"); b.Property("Provider") .HasColumnType("integer"); b.Property("Temperature") .HasColumnType("double precision"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("IsActive"); b.ToTable("AIProfiles", (string)null); }); modelBuilder.Entity("GreenHome.Domain.AIQuery", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Answer") .IsRequired() .HasColumnType("text"); b.Property("CompletionTokens") .HasColumnType("integer"); b.Property("CostUsd") .HasColumnType("decimal(18,8)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .HasColumnType("integer"); b.Property("Model") .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("ProfileId") .HasColumnType("integer"); b.Property("PromptTokens") .HasColumnType("integer"); b.Property("Question") .IsRequired() .HasColumnType("text"); b.Property("ResponseTimeMs") .HasColumnType("bigint"); b.Property("Temperature") .HasColumnType("double precision"); b.Property("TotalTokens") .HasColumnType("integer"); b.Property("UserId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("CreatedAt"); b.HasIndex("DeviceId"); b.HasIndex("ProfileId"); b.HasIndex("UserId"); b.ToTable("AIQueries", (string)null); }); modelBuilder.Entity("GreenHome.Domain.AdminAuditLog", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Action") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("AdminUserId") .HasColumnType("integer"); b.Property("At") .HasColumnType("timestamp with time zone"); b.Property("Details") .IsRequired() .HasMaxLength(2000) .HasColumnType("character varying(8000)"); b.Property("TargetId") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.HasKey("Id"); b.HasIndex("AdminUserId"); b.HasIndex("At"); b.ToTable("AdminAuditLogs", (string)null); }); modelBuilder.Entity("GreenHome.Domain.AlertCondition", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CallCooldownMinutes") .HasColumnType("integer"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .HasColumnType("integer"); b.Property("IsEnabled") .HasColumnType("boolean"); b.Property("NotificationType") .HasColumnType("integer"); b.Property("SmsCooldownMinutes") .HasColumnType("integer"); b.Property("TimeType") .HasColumnType("integer"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceId"); b.ToTable("AlertConditions", (string)null); }); modelBuilder.Entity("GreenHome.Domain.AlertLog", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("AlertConditionId") .HasColumnType("integer"); b.Property("AlertType") .HasColumnType("integer"); b.Property("DeviceId") .HasColumnType("integer"); b.Property("ErrorMessage") .HasMaxLength(2000) .HasColumnType("character varying(8000)"); b.Property("Message") .IsRequired() .HasMaxLength(1000) .HasColumnType("character varying(4000)"); b.Property("NotificationType") .HasColumnType("integer"); b.Property("PhoneNumber") .IsRequired() .HasMaxLength(20) .HasColumnType("character varying(80)"); b.Property("ProcessingTimeMs") .HasColumnType("bigint"); b.Property("SentAt") .HasColumnType("timestamp with time zone"); b.Property("Status") .HasColumnType("integer"); b.Property("UserId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("AlertConditionId"); b.HasIndex("AlertType"); b.HasIndex("Status"); b.HasIndex("DeviceId", "SentAt"); b.HasIndex("UserId", "SentAt"); b.ToTable("AlertLogs", (string)null); }); modelBuilder.Entity("GreenHome.Domain.AlertNotification", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("AlertConditionId") .HasColumnType("integer"); b.Property("DeviceId") .HasColumnType("integer"); b.Property("ErrorMessage") .HasMaxLength(1000) .HasColumnType("character varying(4000)"); b.Property("IsSent") .HasColumnType("boolean"); b.Property("Message") .IsRequired() .HasMaxLength(500) .HasColumnType("character varying(2000)"); b.Property("MessageOutboxIds") .HasMaxLength(500) .HasColumnType("character varying(2000)"); b.Property("NotificationType") .HasColumnType("integer"); b.Property("SentAt") .HasColumnType("timestamp with time zone"); b.Property("UserId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("AlertConditionId"); b.HasIndex("UserId"); b.HasIndex("DeviceId", "UserId", "AlertConditionId", "SentAt"); b.ToTable("AlertNotifications", (string)null); }); modelBuilder.Entity("GreenHome.Domain.AlertRule", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("AlertConditionId") .HasColumnType("integer"); b.Property("ComparisonType") .HasColumnType("integer"); b.Property("Order") .HasColumnType("integer"); b.Property("SensorType") .HasColumnType("integer"); b.Property("Value1") .HasColumnType("decimal(18,2)"); b.Property("Value2") .HasColumnType("decimal(18,2)"); b.HasKey("Id"); b.HasIndex("AlertConditionId"); b.ToTable("AlertRules", (string)null); }); modelBuilder.Entity("GreenHome.Domain.Checklist", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedByUserId") .HasColumnType("integer"); b.Property("Description") .HasMaxLength(1000) .HasColumnType("character varying(4000)"); b.Property("DeviceId") .HasColumnType("integer"); b.Property("IsActive") .HasColumnType("boolean"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(800)"); b.HasKey("Id"); b.HasIndex("CreatedByUserId"); b.HasIndex("DeviceId", "IsActive"); b.ToTable("Checklists", (string)null); }); modelBuilder.Entity("GreenHome.Domain.ChecklistCompletion", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ChecklistId") .HasColumnType("integer"); b.Property("CompletedAt") .HasColumnType("timestamp with time zone"); b.Property("CompletedByUserId") .HasColumnType("integer"); b.Property("Notes") .HasMaxLength(2000) .HasColumnType("character varying(8000)"); b.Property("PersianDate") .IsRequired() .HasMaxLength(10) .HasColumnType("character varying(40)"); b.HasKey("Id"); b.HasIndex("CompletedByUserId"); b.HasIndex("ChecklistId", "PersianDate"); b.ToTable("ChecklistCompletions", (string)null); }); modelBuilder.Entity("GreenHome.Domain.ChecklistItem", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ChecklistId") .HasColumnType("integer"); b.Property("Description") .HasMaxLength(1000) .HasColumnType("character varying(4000)"); b.Property("IsRequired") .HasColumnType("boolean"); b.Property("Order") .HasColumnType("integer"); b.Property("Title") .IsRequired() .HasMaxLength(300) .HasColumnType("character varying(1200)"); b.HasKey("Id"); b.HasIndex("ChecklistId", "Order"); b.ToTable("ChecklistItems", (string)null); }); modelBuilder.Entity("GreenHome.Domain.ChecklistItemCompletion", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ChecklistCompletionId") .HasColumnType("integer"); b.Property("ChecklistItemId") .HasColumnType("integer"); b.Property("IsChecked") .HasColumnType("boolean"); b.Property("Note") .HasMaxLength(500) .HasColumnType("character varying(2000)"); b.HasKey("Id"); b.HasIndex("ChecklistCompletionId"); b.HasIndex("ChecklistItemId"); b.ToTable("ChecklistItemCompletions", (string)null); }); modelBuilder.Entity("GreenHome.Domain.DailyReport", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Analysis") .IsRequired() .HasColumnType("text"); b.Property("CompletionTokens") .HasColumnType("integer"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .HasColumnType("integer"); b.Property("Model") .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("PersianDate") .IsRequired() .HasMaxLength(10) .HasColumnType("character varying(40)"); b.Property("PersianDay") .HasColumnType("integer"); b.Property("PersianMonth") .HasColumnType("integer"); b.Property("PersianYear") .HasColumnType("integer"); b.Property("PromptTokens") .HasColumnType("integer"); b.Property("RecordCount") .HasColumnType("integer"); b.Property("ResponseTimeMs") .HasColumnType("bigint"); b.Property("SampledRecordCount") .HasColumnType("integer"); b.Property("TotalTokens") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("CreatedAt"); b.HasIndex("DeviceId", "PersianDate") .IsUnique(); b.HasIndex("DeviceId", "PersianYear", "PersianMonth"); b.ToTable("DailyReports", (string)null); }); modelBuilder.Entity("GreenHome.Domain.Device", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("DeviceName") .IsRequired() .HasMaxLength(10) .HasColumnType("character varying(40)"); b.Property("Location") .IsRequired() .HasMaxLength(250) .HasColumnType("character varying(1000)"); b.Property("NeshanLocation") .IsRequired() .HasMaxLength(80) .HasColumnType("character varying(320)"); b.Property("ResetRequested") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false); b.Property("UserId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("UserId"); b.ToTable("Devices", (string)null); }); modelBuilder.Entity("GreenHome.Domain.DevicePost", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("AuthorUserId") .HasColumnType("integer"); b.Property("Content") .IsRequired() .HasMaxLength(5000) .HasColumnType("character varying(20000)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .HasColumnType("integer"); b.Property("PostType") .HasColumnType("integer"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.Property("VoiceDurationSeconds") .HasColumnType("integer"); b.Property("VoiceFilePath") .HasMaxLength(500) .HasColumnType("character varying(2000)"); b.HasKey("Id"); b.HasIndex("AuthorUserId"); b.HasIndex("DeviceId", "CreatedAt"); b.ToTable("DevicePosts", (string)null); }); modelBuilder.Entity("GreenHome.Domain.DevicePostImage", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ContentType") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("DevicePostId") .HasColumnType("integer"); b.Property("FileName") .IsRequired() .HasMaxLength(255) .HasColumnType("character varying(1020)"); b.Property("FilePath") .IsRequired() .HasMaxLength(500) .HasColumnType("character varying(2000)"); b.Property("FileSize") .HasColumnType("bigint"); b.Property("UploadedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DevicePostId"); b.ToTable("DevicePostImages", (string)null); }); modelBuilder.Entity("GreenHome.Domain.DeviceRelay", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceSettingsId") .HasColumnType("integer"); b.Property("IsEnabled") .HasColumnType("boolean"); b.Property("Name") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("RelayIndex") .HasColumnType("integer"); b.Property("RelayKind") .HasColumnType("integer"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("DeviceSettingsId", "RelayIndex") .IsUnique(); b.ToTable("DeviceRelays", (string)null); }); modelBuilder.Entity("GreenHome.Domain.DeviceSettings", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("AreaSquareMeters") .HasColumnType("decimal(18,2)"); b.Property("City") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .HasColumnType("integer"); b.Property("DeviceId1") .HasColumnType("integer"); b.Property("DevicePhoneNumber") .IsRequired() .HasColumnType("text"); b.Property("Latitude") .HasColumnType("decimal(9,6)"); b.Property("Longitude") .HasColumnType("decimal(9,6)"); b.Property("MinimumCallIntervalMinutes") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasDefaultValue(60); b.Property("MinimumSmsIntervalMinutes") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasDefaultValue(15); b.Property("ProductType") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("Province") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("RelayCount") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasDefaultValue(4); b.Property("SimCardType") .HasColumnType("integer"); b.Property("SmsRecievers") .IsRequired() .HasMaxLength(120) .HasColumnType("character varying(480)"); b.Property("TokenCode") .HasColumnType("text"); b.Property("TokenExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.Property("UploadIntervalMin") .HasColumnType("integer"); b.Property("VerificationCode") .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("DeviceId") .IsUnique(); b.HasIndex("DeviceId1"); b.ToTable("DeviceSettings", (string)null); }); modelBuilder.Entity("GreenHome.Domain.DeviceUser", b => { b.Property("DeviceId") .HasColumnType("integer"); b.Property("UserId") .HasColumnType("integer"); b.Property("AvatarPath") .HasMaxLength(500) .HasColumnType("character varying(2000)"); b.Property("Family") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("Name") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("ReceiveAlerts") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(true); b.Property("Role") .HasColumnType("integer"); b.HasKey("DeviceId", "UserId"); b.HasIndex("UserId"); b.ToTable("DeviceUsers", (string)null); }); modelBuilder.Entity("GreenHome.Domain.PowerOutageLog", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CurrentPower") .HasColumnType("smallint"); b.Property("DeviceId") .HasColumnType("integer"); b.Property("EventType") .HasColumnType("integer"); b.Property("PersianDate") .IsRequired() .HasMaxLength(10) .HasColumnType("character varying(40)"); b.Property("PersianMonth") .HasColumnType("integer"); b.Property("PersianYear") .HasColumnType("integer"); b.Property("PreviousPower") .HasColumnType("smallint"); b.Property("ServerTimestampUtc") .HasColumnType("timestamp with time zone"); b.Property("TimestampUtc") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("EventType"); b.HasIndex("DeviceId", "TimestampUtc"); b.HasIndex("DeviceId", "PersianYear", "PersianMonth"); b.ToTable("PowerOutageLogs", (string)null); }); modelBuilder.Entity("GreenHome.Domain.RelayRuleCondition", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ComparisonType") .HasColumnType("integer"); b.Property("ConditionType") .HasColumnType("integer"); b.Property("EndMinutes") .HasColumnType("integer"); b.Property("Order") .HasColumnType("integer"); b.Property("RelayRuleGroupId") .HasColumnType("integer"); b.Property("SensorType") .HasColumnType("integer"); b.Property("StartMinutes") .HasColumnType("integer"); b.Property("Value1") .HasColumnType("decimal(18,2)"); b.Property("Value2") .HasColumnType("decimal(18,2)"); b.HasKey("Id"); b.HasIndex("RelayRuleGroupId"); b.ToTable("RelayRuleConditions", (string)null); }); modelBuilder.Entity("GreenHome.Domain.RelayRuleGroup", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Action") .HasColumnType("integer"); b.Property("DeviceRelayId") .HasColumnType("integer"); b.Property("Label") .HasMaxLength(200) .HasColumnType("character varying(800)"); b.Property("Order") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("DeviceRelayId"); b.ToTable("RelayRuleGroups", (string)null); }); modelBuilder.Entity("GreenHome.Domain.ReportImage", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("ContentType") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("Description") .HasMaxLength(500) .HasColumnType("character varying(2000)"); b.Property("FileName") .IsRequired() .HasMaxLength(255) .HasColumnType("character varying(1020)"); b.Property("FilePath") .IsRequired() .HasMaxLength(500) .HasColumnType("character varying(2000)"); b.Property("FileSize") .HasColumnType("bigint"); b.Property("UploadedAt") .HasColumnType("timestamp with time zone"); b.Property("UserDailyReportId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("UserDailyReportId"); b.ToTable("ReportImages", (string)null); }); modelBuilder.Entity("GreenHome.Domain.TelemetryRecord", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("BatteryPercent") .HasColumnType("decimal(18,2)"); b.Property("BatteryVoltage") .HasColumnType("decimal(18,2)"); b.Property("DeviceId") .HasColumnType("integer"); b.Property("GasPPM") .HasColumnType("integer"); b.Property("HumidityPercent") .HasColumnType("decimal(18,2)"); b.Property("Lux") .HasColumnType("decimal(18,2)"); b.Property("PersianDate") .IsRequired() .HasMaxLength(10) .HasColumnType("character varying(40)"); b.Property("PersianMonth") .HasColumnType("integer"); b.Property("PersianYear") .HasColumnType("integer"); b.Property("Power") .HasColumnType("smallint"); b.Property("RelayStates") .HasMaxLength(64) .HasColumnType("character varying(256)"); b.Property("ServerTimestampUtc") .HasColumnType("timestamp with time zone"); b.Property("SoilPercent") .HasColumnType("decimal(18,2)"); b.Property("TemperatureC") .HasColumnType("decimal(18,2)"); b.Property("TimestampUtc") .HasColumnType("timestamp with time zone"); b.Property("Voltage") .HasColumnType("decimal(18,2)"); b.HasKey("Id"); b.HasIndex("DeviceId", "ServerTimestampUtc"); b.HasIndex("DeviceId", "TimestampUtc"); b.HasIndex("DeviceId", "PersianYear", "PersianMonth"); b.ToTable("Telemetry", (string)null); }); modelBuilder.Entity("GreenHome.Domain.UsageCounter", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("AiQueryCount") .HasColumnType("integer"); b.Property("AiTokenCount") .HasColumnType("integer"); b.Property("Date") .HasColumnType("date"); b.Property("SmsCount") .HasColumnType("integer"); b.Property("UserId") .HasColumnType("integer"); b.Property("VoiceCallCount") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("Date"); b.HasIndex("UserId", "Date") .IsUnique(); b.ToTable("UsageCounters", (string)null); }); modelBuilder.Entity("GreenHome.Domain.User", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("Family") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("IsDisabled") .HasColumnType("boolean"); b.Property("LastLoginAt") .HasColumnType("timestamp with time zone"); b.Property("Mobile") .IsRequired() .HasMaxLength(11) .HasColumnType("character varying(44)"); b.Property("Name") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(400)"); b.Property("Role") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("Mobile") .IsUnique(); b.ToTable("Users", (string)null); }); modelBuilder.Entity("GreenHome.Domain.UserDailyReport", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeviceId") .HasColumnType("integer"); b.Property("Notes") .HasMaxLength(2000) .HasColumnType("character varying(8000)"); b.Property("Observations") .IsRequired() .HasColumnType("text"); b.Property("Operations") .IsRequired() .HasColumnType("text"); b.Property("PersianDate") .IsRequired() .HasMaxLength(10) .HasColumnType("character varying(40)"); b.Property("PersianDay") .HasColumnType("integer"); b.Property("PersianMonth") .HasColumnType("integer"); b.Property("PersianYear") .HasColumnType("integer"); b.Property("Title") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(800)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.Property("UserId") .HasColumnType("integer"); b.HasKey("Id"); b.HasIndex("UserId"); b.HasIndex("DeviceId", "PersianDate"); b.HasIndex("DeviceId", "PersianYear", "PersianMonth"); b.ToTable("UserDailyReports", (string)null); }); modelBuilder.Entity("GreenHome.Domain.VerificationCode", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer"); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); b.Property("Code") .IsRequired() .HasMaxLength(4) .HasColumnType("character varying(16)"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("ExpiresAt") .HasColumnType("timestamp with time zone"); b.Property("IsUsed") .HasColumnType("boolean"); b.Property("Mobile") .IsRequired() .HasMaxLength(11) .HasColumnType("character varying(44)"); b.Property("UsedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("Mobile", "Code", "IsUsed"); b.ToTable("VerificationCodes", (string)null); }); modelBuilder.Entity("GreenHome.Domain.AIQuery", b => { b.HasOne("GreenHome.Domain.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.SetNull); b.HasOne("GreenHome.Domain.AIProfile", "Profile") .WithMany() .HasForeignKey("ProfileId") .OnDelete(DeleteBehavior.SetNull); b.HasOne("GreenHome.Domain.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.SetNull); b.Navigation("Device"); b.Navigation("Profile"); b.Navigation("User"); }); modelBuilder.Entity("GreenHome.Domain.AdminAuditLog", b => { b.HasOne("GreenHome.Domain.User", "AdminUser") .WithMany() .HasForeignKey("AdminUserId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("AdminUser"); }); modelBuilder.Entity("GreenHome.Domain.AlertCondition", b => { b.HasOne("GreenHome.Domain.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); }); modelBuilder.Entity("GreenHome.Domain.AlertLog", b => { b.HasOne("GreenHome.Domain.AlertCondition", "AlertCondition") .WithMany() .HasForeignKey("AlertConditionId") .OnDelete(DeleteBehavior.SetNull); b.HasOne("GreenHome.Domain.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("GreenHome.Domain.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("AlertCondition"); b.Navigation("Device"); b.Navigation("User"); }); modelBuilder.Entity("GreenHome.Domain.AlertNotification", b => { b.HasOne("GreenHome.Domain.AlertCondition", "AlertCondition") .WithMany() .HasForeignKey("AlertConditionId") .OnDelete(DeleteBehavior.Restrict); b.HasOne("GreenHome.Domain.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("GreenHome.Domain.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("AlertCondition"); b.Navigation("Device"); b.Navigation("User"); }); modelBuilder.Entity("GreenHome.Domain.AlertRule", b => { b.HasOne("GreenHome.Domain.AlertCondition", "AlertCondition") .WithMany("Rules") .HasForeignKey("AlertConditionId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("AlertCondition"); }); modelBuilder.Entity("GreenHome.Domain.Checklist", b => { b.HasOne("GreenHome.Domain.User", "CreatedByUser") .WithMany() .HasForeignKey("CreatedByUserId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("GreenHome.Domain.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("CreatedByUser"); b.Navigation("Device"); }); modelBuilder.Entity("GreenHome.Domain.ChecklistCompletion", b => { b.HasOne("GreenHome.Domain.Checklist", "Checklist") .WithMany("Completions") .HasForeignKey("ChecklistId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("GreenHome.Domain.User", "CompletedByUser") .WithMany() .HasForeignKey("CompletedByUserId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Checklist"); b.Navigation("CompletedByUser"); }); modelBuilder.Entity("GreenHome.Domain.ChecklistItem", b => { b.HasOne("GreenHome.Domain.Checklist", "Checklist") .WithMany("Items") .HasForeignKey("ChecklistId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Checklist"); }); modelBuilder.Entity("GreenHome.Domain.ChecklistItemCompletion", b => { b.HasOne("GreenHome.Domain.ChecklistCompletion", "ChecklistCompletion") .WithMany("ItemCompletions") .HasForeignKey("ChecklistCompletionId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("GreenHome.Domain.ChecklistItem", "ChecklistItem") .WithMany() .HasForeignKey("ChecklistItemId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("ChecklistCompletion"); b.Navigation("ChecklistItem"); }); modelBuilder.Entity("GreenHome.Domain.DailyReport", b => { b.HasOne("GreenHome.Domain.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); }); modelBuilder.Entity("GreenHome.Domain.Device", b => { b.HasOne("GreenHome.Domain.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("GreenHome.Domain.DevicePost", b => { b.HasOne("GreenHome.Domain.User", "AuthorUser") .WithMany() .HasForeignKey("AuthorUserId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.HasOne("GreenHome.Domain.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("AuthorUser"); b.Navigation("Device"); }); modelBuilder.Entity("GreenHome.Domain.DevicePostImage", b => { b.HasOne("GreenHome.Domain.DevicePost", "DevicePost") .WithMany("Images") .HasForeignKey("DevicePostId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("DevicePost"); }); modelBuilder.Entity("GreenHome.Domain.DeviceRelay", b => { b.HasOne("GreenHome.Domain.DeviceSettings", "DeviceSettings") .WithMany("Relays") .HasForeignKey("DeviceSettingsId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("DeviceSettings"); }); modelBuilder.Entity("GreenHome.Domain.DeviceSettings", b => { b.HasOne("GreenHome.Domain.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("GreenHome.Domain.Device", null) .WithMany("DeviceSettings") .HasForeignKey("DeviceId1"); b.Navigation("Device"); }); modelBuilder.Entity("GreenHome.Domain.DeviceUser", b => { b.HasOne("GreenHome.Domain.Device", "Device") .WithMany("DeviceUsers") .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("GreenHome.Domain.User", "User") .WithMany("DeviceUsers") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); b.Navigation("User"); }); modelBuilder.Entity("GreenHome.Domain.PowerOutageLog", b => { b.HasOne("GreenHome.Domain.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Device"); }); modelBuilder.Entity("GreenHome.Domain.RelayRuleCondition", b => { b.HasOne("GreenHome.Domain.RelayRuleGroup", "RelayRuleGroup") .WithMany("Conditions") .HasForeignKey("RelayRuleGroupId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("RelayRuleGroup"); }); modelBuilder.Entity("GreenHome.Domain.RelayRuleGroup", b => { b.HasOne("GreenHome.Domain.DeviceRelay", "DeviceRelay") .WithMany("RuleGroups") .HasForeignKey("DeviceRelayId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("DeviceRelay"); }); modelBuilder.Entity("GreenHome.Domain.ReportImage", b => { b.HasOne("GreenHome.Domain.UserDailyReport", "UserDailyReport") .WithMany("Images") .HasForeignKey("UserDailyReportId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("UserDailyReport"); }); modelBuilder.Entity("GreenHome.Domain.UsageCounter", b => { b.HasOne("GreenHome.Domain.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("GreenHome.Domain.UserDailyReport", b => { b.HasOne("GreenHome.Domain.Device", "Device") .WithMany() .HasForeignKey("DeviceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("GreenHome.Domain.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Device"); b.Navigation("User"); }); modelBuilder.Entity("GreenHome.Domain.AlertCondition", b => { b.Navigation("Rules"); }); modelBuilder.Entity("GreenHome.Domain.Checklist", b => { b.Navigation("Completions"); b.Navigation("Items"); }); modelBuilder.Entity("GreenHome.Domain.ChecklistCompletion", b => { b.Navigation("ItemCompletions"); }); modelBuilder.Entity("GreenHome.Domain.Device", b => { b.Navigation("DeviceSettings"); b.Navigation("DeviceUsers"); }); modelBuilder.Entity("GreenHome.Domain.DevicePost", b => { b.Navigation("Images"); }); modelBuilder.Entity("GreenHome.Domain.DeviceRelay", b => { b.Navigation("RuleGroups"); }); modelBuilder.Entity("GreenHome.Domain.DeviceSettings", b => { b.Navigation("Relays"); }); modelBuilder.Entity("GreenHome.Domain.RelayRuleGroup", b => { b.Navigation("Conditions"); }); modelBuilder.Entity("GreenHome.Domain.User", b => { b.Navigation("DeviceUsers"); }); modelBuilder.Entity("GreenHome.Domain.UserDailyReport", b => { b.Navigation("Images"); }); #pragma warning restore 612, 618 } } }