// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TeleWave.Infrastructure.Persistence;

#nullable disable

namespace TeleWave.Infrastructure.Migrations
{
    [DbContext(typeof(AppDbContext))]
    [Migration("20260726102012_AddJunctionTemplates")]
    partial class AddJunctionTemplates
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "10.0.10")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<string>("ClaimType")
                        .HasColumnType("text");

                    b.Property<string>("ClaimValue")
                        .HasColumnType("text");

                    b.Property<Guid>("RoleId")
                        .HasColumnType("uuid");

                    b.HasKey("Id");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetRoleClaims", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<string>("ClaimType")
                        .HasColumnType("text");

                    b.Property<string>("ClaimValue")
                        .HasColumnType("text");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserClaims", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
                {
                    b.Property<string>("LoginProvider")
                        .HasColumnType("text");

                    b.Property<string>("ProviderKey")
                        .HasColumnType("text");

                    b.Property<string>("ProviderDisplayName")
                        .HasColumnType("text");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid");

                    b.HasKey("LoginProvider", "ProviderKey");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserLogins", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
                {
                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("RoleId")
                        .HasColumnType("uuid");

                    b.HasKey("UserId", "RoleId");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetUserRoles", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
                {
                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid");

                    b.Property<string>("LoginProvider")
                        .HasColumnType("text");

                    b.Property<string>("Name")
                        .HasColumnType("text");

                    b.Property<string>("Value")
                        .HasColumnType("text");

                    b.HasKey("UserId", "LoginProvider", "Name");

                    b.ToTable("AspNetUserTokens", (string)null);
                });

            modelBuilder.Entity("TeleWave.Domain.Auth.RefreshToken", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset>("ExpiresAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("ReplacedByTokenHash")
                        .HasColumnType("text");

                    b.Property<DateTimeOffset?>("RevokedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("TokenHash")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid");

                    b.HasKey("Id");

                    b.HasIndex("TokenHash")
                        .IsUnique();

                    b.HasIndex("UserId");

                    b.ToTable("RefreshTokens");
                });

            modelBuilder.Entity("TeleWave.Domain.Broadcast.BumperAsset", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<Guid>("ChannelId")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<Guid>("FromShowId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("MediaAssetId")
                        .HasColumnType("uuid");

                    b.Property<string>("Signature")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("character varying(128)");

                    b.Property<Guid>("TemplateId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("ToShowId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("VariantId")
                        .HasColumnType("uuid");

                    b.HasKey("Id");

                    b.HasIndex("FromShowId", "ToShowId", "Signature");

                    b.ToTable("BumperAssets");
                });

            modelBuilder.Entity("TeleWave.Domain.Broadcast.BumperTemplate", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<string>("AccentColor")
                        .IsRequired()
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)");

                    b.Property<double?>("AudioDurationSeconds")
                        .HasColumnType("double precision");

                    b.Property<string>("AudioExtension")
                        .HasMaxLength(16)
                        .HasColumnType("character varying(16)");

                    b.Property<string>("BackgroundColor")
                        .IsRequired()
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)");

                    b.Property<string>("BackgroundColor2")
                        .IsRequired()
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)");

                    b.Property<Guid?>("BackgroundImageId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("ChannelId")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)");

                    b.Property<int>("Position")
                        .HasColumnType("integer");

                    b.Property<int>("Revision")
                        .HasColumnType("integer");

                    b.Property<string>("TextColor")
                        .IsRequired()
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)");

                    b.HasKey("Id");

                    b.HasIndex("ChannelId", "Position");

                    b.ToTable("BumperTemplate");
                });

            modelBuilder.Entity("TeleWave.Domain.Broadcast.BumperTextVariant", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<Guid>("BumperTemplateId")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("Kind")
                        .HasColumnType("integer");

                    b.Property<string>("Line1")
                        .IsRequired()
                        .HasMaxLength(120)
                        .HasColumnType("character varying(120)");

                    b.Property<string>("Line2")
                        .IsRequired()
                        .HasMaxLength(120)
                        .HasColumnType("character varying(120)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)");

                    b.Property<string>("NextLabel")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)");

                    b.Property<string>("NowLabel")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)");

                    b.Property<int>("Position")
                        .HasColumnType("integer");

                    b.Property<int>("Trigger")
                        .HasColumnType("integer");

                    b.Property<int>("Weight")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasDefaultValue(1);

                    b.HasKey("Id");

                    b.HasIndex("BumperTemplateId", "Position");

                    b.ToTable("BumperTextVariants");
                });

            modelBuilder.Entity("TeleWave.Domain.Broadcast.Channel", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<double>("BumperEpisodeChangeChance")
                        .HasColumnType("double precision");

                    b.Property<int>("BumperFont")
                        .HasColumnType("integer");

                    b.Property<int>("BumperMinIntervalMinutes")
                        .HasColumnType("integer");

                    b.Property<int>("BumperSelection")
                        .HasColumnType("integer");

                    b.Property<double>("BumperShowChangeChance")
                        .HasColumnType("double precision");

                    b.Property<bool>("BumpersEnabled")
                        .HasColumnType("boolean");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<TimeOnly>("DayStartTime")
                        .HasColumnType("time without time zone");

                    b.Property<DateTimeOffset>("EpochUtc")
                        .HasColumnType("timestamp with time zone");

                    b.Property<Guid?>("FillerAssetId")
                        .HasColumnType("uuid");

                    b.Property<bool>("IsEnabled")
                        .HasColumnType("boolean");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<int>("NextBumperIndex")
                        .HasColumnType("integer");

                    b.Property<int?>("Number")
                        .HasColumnType("integer");

                    b.Property<string>("Slug")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("character varying(128)");

                    b.Property<Guid?>("TemplateId")
                        .HasColumnType("uuid");

                    b.Property<int>("UtcOffsetMinutes")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("Number")
                        .IsUnique()
                        .HasFilter("\"Number\" IS NOT NULL");

                    b.HasIndex("Slug")
                        .IsUnique();

                    b.ToTable("Channels");
                });

            modelBuilder.Entity("TeleWave.Domain.Broadcast.ScheduleEntry", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<Guid?>("BumperVariantId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("ChannelId")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("EndsAtUtc")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("EpisodeIndex")
                        .HasColumnType("integer");

                    b.Property<int>("Kind")
                        .HasColumnType("integer");

                    b.Property<Guid>("MediaAssetId")
                        .HasColumnType("uuid");

                    b.Property<Guid?>("ShowId")
                        .HasColumnType("uuid");

                    b.Property<Guid?>("SlotId")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("StartsAtUtc")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("TraceJson")
                        .HasColumnType("jsonb");

                    b.HasKey("Id");

                    b.HasIndex("ChannelId", "EndsAtUtc");

                    b.HasIndex("ChannelId", "StartsAtUtc");

                    b.HasIndex("ChannelId", "ShowId", "StartsAtUtc");

                    b.ToTable("ScheduleEntries");
                });

            modelBuilder.Entity("TeleWave.Domain.Images.Image", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<int>("Category")
                        .HasColumnType("integer");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("FileExtension")
                        .IsRequired()
                        .HasMaxLength(16)
                        .HasColumnType("character varying(16)");

                    b.Property<string>("OriginalFileName")
                        .HasMaxLength(512)
                        .HasColumnType("character varying(512)");

                    b.HasKey("Id");

                    b.HasIndex("Category", "CreatedAt");

                    b.ToTable("Images");
                });

            modelBuilder.Entity("TeleWave.Domain.Library.Collection", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Description")
                        .HasMaxLength(2048)
                        .HasColumnType("character varying(2048)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<Guid?>("PosterImageId")
                        .HasColumnType("uuid");

                    b.HasKey("Id");

                    b.ToTable("Collections");
                });

            modelBuilder.Entity("TeleWave.Domain.Library.CollectionItem", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<Guid>("CollectionId")
                        .HasColumnType("uuid");

                    b.Property<int>("Position")
                        .HasColumnType("integer");

                    b.Property<Guid>("ShowId")
                        .HasColumnType("uuid");

                    b.HasKey("Id");

                    b.HasIndex("ShowId");

                    b.HasIndex("CollectionId", "Position");

                    b.HasIndex("CollectionId", "ShowId")
                        .IsUnique();

                    b.ToTable("CollectionItems");
                });

            modelBuilder.Entity("TeleWave.Domain.Library.Genre", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<bool>("IsSystem")
                        .HasColumnType("boolean");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("character varying(128)");

                    b.Property<string>("Slug")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)");

                    b.Property<int>("SortOrder")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("Slug")
                        .IsUnique();

                    b.ToTable("Genres");
                });

            modelBuilder.Entity("TeleWave.Domain.Library.GenreAlias", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<Guid>("GenreId")
                        .HasColumnType("uuid");

                    b.Property<string>("Value")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("character varying(128)");

                    b.HasKey("Id");

                    b.HasIndex("GenreId");

                    b.HasIndex("Value")
                        .IsUnique();

                    b.ToTable("GenreAliases");
                });

            modelBuilder.Entity("TeleWave.Domain.Library.Show", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<int>("Audience")
                        .HasColumnType("integer");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Description")
                        .HasMaxLength(2048)
                        .HasColumnType("character varying(2048)");

                    b.Property<int>("Kind")
                        .HasColumnType("integer");

                    b.Property<string>("MetadataExternalId")
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)");

                    b.Property<string>("MetadataProvider")
                        .HasMaxLength(16)
                        .HasColumnType("character varying(16)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<string>("OriginalName")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<Guid?>("PosterImageId")
                        .HasColumnType("uuid");

                    b.Property<int?>("Year")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.ToTable("Shows");
                });

            modelBuilder.Entity("TeleWave.Domain.Library.ShowEpisode", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<DateOnly?>("AirDate")
                        .HasColumnType("date");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int?>("Episode")
                        .HasColumnType("integer");

                    b.Property<Guid>("MediaAssetId")
                        .HasColumnType("uuid");

                    b.Property<string>("Overview")
                        .HasMaxLength(4096)
                        .HasColumnType("character varying(4096)");

                    b.Property<int>("Position")
                        .HasColumnType("integer");

                    b.Property<int?>("Season")
                        .HasColumnType("integer");

                    b.Property<Guid>("ShowId")
                        .HasColumnType("uuid");

                    b.Property<Guid?>("StillImageId")
                        .HasColumnType("uuid");

                    b.Property<string>("Title")
                        .HasMaxLength(512)
                        .HasColumnType("character varying(512)");

                    b.HasKey("Id");

                    b.HasIndex("MediaAssetId");

                    b.HasIndex("ShowId", "Position");

                    b.ToTable("ShowEpisode");
                });

            modelBuilder.Entity("TeleWave.Domain.Library.ShowGenre", b =>
                {
                    b.Property<Guid>("ShowId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("GenreId")
                        .HasColumnType("uuid");

                    b.Property<bool>("IsPrimary")
                        .HasColumnType("boolean");

                    b.HasKey("ShowId", "GenreId");

                    b.HasIndex("GenreId");

                    b.ToTable("ShowGenres");
                });

            modelBuilder.Entity("TeleWave.Domain.Media.MediaAsset", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<string>("AudioCodec")
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<TimeSpan?>("Duration")
                        .HasColumnType("interval");

                    b.Property<string>("ErrorMessage")
                        .HasMaxLength(2048)
                        .HasColumnType("character varying(2048)");

                    b.Property<int?>("Height")
                        .HasColumnType("integer");

                    b.Property<string>("OriginalExtension")
                        .IsRequired()
                        .HasMaxLength(16)
                        .HasColumnType("character varying(16)");

                    b.Property<string>("OriginalFileName")
                        .IsRequired()
                        .HasMaxLength(512)
                        .HasColumnType("character varying(512)");

                    b.Property<TimeSpan?>("ProcessingDuration")
                        .HasColumnType("interval");

                    b.Property<DateTimeOffset?>("ProcessingStartedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("RelativePath")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<int?>("SegmentCount")
                        .HasColumnType("integer");

                    b.Property<int?>("SegmentSeconds")
                        .HasColumnType("integer");

                    b.Property<int>("Source")
                        .HasColumnType("integer");

                    b.Property<int>("Status")
                        .HasColumnType("integer");

                    b.Property<DateTimeOffset>("UpdatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("VideoCodec")
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)");

                    b.Property<int?>("Width")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("CreatedAt");

                    b.HasIndex("Status");

                    b.ToTable("MediaAssets");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.GridLayer", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<string>("ApplicabilityJson")
                        .HasColumnType("jsonb");

                    b.Property<bool>("IsBackground")
                        .HasColumnType("boolean");

                    b.Property<bool>("IsEnabled")
                        .HasColumnType("boolean");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("character varying(128)");

                    b.Property<int>("Priority")
                        .HasColumnType("integer");

                    b.Property<Guid>("TemplateId")
                        .HasColumnType("uuid");

                    b.HasKey("Id");

                    b.HasIndex("TemplateId", "Priority");

                    b.ToTable("GridLayers");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.Group", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Description")
                        .HasMaxLength(2048)
                        .HasColumnType("character varying(2048)");

                    b.Property<string>("FilterJson")
                        .HasColumnType("jsonb");

                    b.Property<int>("ItemCount")
                        .HasColumnType("integer");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<DateTimeOffset?>("StatsComputedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<TimeSpan>("TotalDuration")
                        .HasColumnType("interval");

                    b.Property<int>("UnitCount")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.ToTable("Groups");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.GroupItem", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<Guid>("ElementId")
                        .HasColumnType("uuid");

                    b.Property<int>("ElementKind")
                        .HasColumnType("integer");

                    b.Property<Guid>("GroupId")
                        .HasColumnType("uuid");

                    b.Property<int>("Position")
                        .HasColumnType("integer");

                    b.Property<int>("Weight")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("ElementKind", "ElementId");

                    b.HasIndex("GroupId", "Position");

                    b.HasIndex("GroupId", "ElementKind", "ElementId")
                        .IsUnique();

                    b.ToTable("GroupItems");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.JunctionElement", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<int>("AmountMode")
                        .HasColumnType("integer");

                    b.Property<int>("AmountValue")
                        .HasColumnType("integer");

                    b.Property<Guid?>("BumperTemplateId")
                        .HasColumnType("uuid");

                    b.Property<string>("ConditionsJson")
                        .HasColumnType("jsonb");

                    b.Property<Guid?>("GroupId")
                        .HasColumnType("uuid");

                    b.Property<bool>("IsRequired")
                        .HasColumnType("boolean");

                    b.Property<Guid>("JunctionTemplateId")
                        .HasColumnType("uuid");

                    b.Property<int>("Kind")
                        .HasColumnType("integer");

                    b.Property<int>("Position")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("GroupId");

                    b.HasIndex("JunctionTemplateId", "Position");

                    b.ToTable("JunctionElements");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.JunctionTemplate", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<Guid>("ChannelId")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(128)
                        .HasColumnType("character varying(128)");

                    b.HasKey("Id");

                    b.HasIndex("ChannelId");

                    b.ToTable("JunctionTemplates");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.ScheduleTemplate", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<int>("AppliedRevision")
                        .HasColumnType("integer");

                    b.Property<Guid>("ChannelId")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<Guid?>("DefaultJunctionId")
                        .HasColumnType("uuid");

                    b.Property<Guid?>("FallbackGroupId")
                        .HasColumnType("uuid");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<int>("Revision")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("ChannelId");

                    b.ToTable("ScheduleTemplates");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.Slot", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid");

                    b.Property<int>("BlockMode")
                        .HasColumnType("integer");

                    b.Property<int>("BlockValue")
                        .HasColumnType("integer");

                    b.Property<int>("Daypart")
                        .HasColumnType("integer");

                    b.Property<Guid?>("GroupId")
                        .HasColumnType("uuid");

                    b.Property<bool>("IsAnchor")
                        .HasColumnType("boolean");

                    b.Property<Guid?>("JunctionAfterId")
                        .HasColumnType("uuid");

                    b.Property<Guid?>("JunctionBetweenId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("LayerId")
                        .HasColumnType("uuid");

                    b.Property<int>("MaxDriftMinutes")
                        .HasColumnType("integer");

                    b.Property<int>("OverflowPolicy")
                        .HasColumnType("integer");

                    b.Property<string>("RepeatSourceJson")
                        .HasColumnType("jsonb");

                    b.Property<int>("SlotKind")
                        .HasColumnType("integer");

                    b.Property<int?>("SnapToMinutes")
                        .HasColumnType("integer");

                    b.Property<string>("StrategyJson")
                        .HasColumnType("jsonb");

                    b.Property<int>("TargetDurationMinutes")
                        .HasColumnType("integer");

                    b.Property<TimeOnly>("TargetStart")
                        .HasColumnType("time without time zone");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<int?>("Weekday")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("GroupId");

                    b.HasIndex("LayerId", "TargetStart");

                    b.ToTable("Slots");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.SlotState", b =>
                {
                    b.Property<Guid>("SlotId")
                        .HasColumnType("uuid");

                    b.Property<Guid?>("CurrentElementId")
                        .HasColumnType("uuid");

                    b.Property<int?>("CurrentElementKind")
                        .HasColumnType("integer");

                    b.Property<int>("NextUnitIndex")
                        .HasColumnType("integer");

                    b.HasKey("SlotId");

                    b.ToTable("SlotStates");
                });

            modelBuilder.Entity("TeleWave.Domain.Settings.AppSetting", b =>
                {
                    b.Property<string>("Key")
                        .HasMaxLength(128)
                        .HasColumnType("character varying(128)");

                    b.Property<string>("Value")
                        .IsRequired()
                        .HasMaxLength(1024)
                        .HasColumnType("character varying(1024)");

                    b.HasKey("Key");

                    b.ToTable("AppSettings");
                });

            modelBuilder.Entity("TeleWave.Infrastructure.Identity.AppRole", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("text");

                    b.Property<bool>("IsSystem")
                        .HasColumnType("boolean");

                    b.Property<string>("Name")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<string>("NormalizedName")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.HasKey("Id");

                    b.HasIndex("NormalizedName")
                        .IsUnique()
                        .HasDatabaseName("RoleNameIndex");

                    b.ToTable("AspNetRoles", (string)null);
                });

            modelBuilder.Entity("TeleWave.Infrastructure.Identity.AppUser", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<int>("AccessFailedCount")
                        .HasColumnType("integer");

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("text");

                    b.Property<DateTimeOffset>("CreatedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Email")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<bool>("EmailConfirmed")
                        .HasColumnType("boolean");

                    b.Property<bool>("IsBlocked")
                        .HasColumnType("boolean");

                    b.Property<bool>("LockoutEnabled")
                        .HasColumnType("boolean");

                    b.Property<DateTimeOffset?>("LockoutEnd")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("NormalizedEmail")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<string>("NormalizedUserName")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<string>("PasswordHash")
                        .HasColumnType("text");

                    b.Property<string>("PhoneNumber")
                        .HasColumnType("text");

                    b.Property<bool>("PhoneNumberConfirmed")
                        .HasColumnType("boolean");

                    b.Property<string>("SecurityStamp")
                        .HasColumnType("text");

                    b.Property<bool>("TwoFactorEnabled")
                        .HasColumnType("boolean");

                    b.Property<string>("UserName")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.HasKey("Id");

                    b.HasIndex("NormalizedEmail")
                        .HasDatabaseName("EmailIndex");

                    b.HasIndex("NormalizedUserName")
                        .IsUnique()
                        .HasDatabaseName("UserNameIndex");

                    b.ToTable("AspNetUsers", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
                {
                    b.HasOne("TeleWave.Infrastructure.Identity.AppRole", null)
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
                {
                    b.HasOne("TeleWave.Infrastructure.Identity.AppUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
                {
                    b.HasOne("TeleWave.Infrastructure.Identity.AppUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
                {
                    b.HasOne("TeleWave.Infrastructure.Identity.AppRole", null)
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("TeleWave.Infrastructure.Identity.AppUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
                {
                    b.HasOne("TeleWave.Infrastructure.Identity.AppUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Broadcast.BumperTemplate", b =>
                {
                    b.HasOne("TeleWave.Domain.Broadcast.Channel", null)
                        .WithMany("BumperTemplates")
                        .HasForeignKey("ChannelId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Broadcast.BumperTextVariant", b =>
                {
                    b.HasOne("TeleWave.Domain.Broadcast.BumperTemplate", null)
                        .WithMany("Variants")
                        .HasForeignKey("BumperTemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Library.CollectionItem", b =>
                {
                    b.HasOne("TeleWave.Domain.Library.Collection", null)
                        .WithMany("Items")
                        .HasForeignKey("CollectionId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("TeleWave.Domain.Library.Show", null)
                        .WithMany()
                        .HasForeignKey("ShowId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Library.GenreAlias", b =>
                {
                    b.HasOne("TeleWave.Domain.Library.Genre", null)
                        .WithMany("Aliases")
                        .HasForeignKey("GenreId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Library.ShowEpisode", b =>
                {
                    b.HasOne("TeleWave.Domain.Library.Show", null)
                        .WithMany("Episodes")
                        .HasForeignKey("ShowId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Library.ShowGenre", b =>
                {
                    b.HasOne("TeleWave.Domain.Library.Genre", null)
                        .WithMany()
                        .HasForeignKey("GenreId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("TeleWave.Domain.Library.Show", null)
                        .WithMany("Genres")
                        .HasForeignKey("ShowId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.GridLayer", b =>
                {
                    b.HasOne("TeleWave.Domain.Programming.ScheduleTemplate", null)
                        .WithMany("Layers")
                        .HasForeignKey("TemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.GroupItem", b =>
                {
                    b.HasOne("TeleWave.Domain.Programming.Group", null)
                        .WithMany("Items")
                        .HasForeignKey("GroupId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.JunctionElement", b =>
                {
                    b.HasOne("TeleWave.Domain.Programming.Group", null)
                        .WithMany()
                        .HasForeignKey("GroupId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("TeleWave.Domain.Programming.JunctionTemplate", null)
                        .WithMany("Elements")
                        .HasForeignKey("JunctionTemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.Slot", b =>
                {
                    b.HasOne("TeleWave.Domain.Programming.Group", null)
                        .WithMany()
                        .HasForeignKey("GroupId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("TeleWave.Domain.Programming.GridLayer", null)
                        .WithMany("Slots")
                        .HasForeignKey("LayerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.SlotState", b =>
                {
                    b.HasOne("TeleWave.Domain.Programming.Slot", null)
                        .WithOne()
                        .HasForeignKey("TeleWave.Domain.Programming.SlotState", "SlotId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("TeleWave.Domain.Broadcast.BumperTemplate", b =>
                {
                    b.Navigation("Variants");
                });

            modelBuilder.Entity("TeleWave.Domain.Broadcast.Channel", b =>
                {
                    b.Navigation("BumperTemplates");
                });

            modelBuilder.Entity("TeleWave.Domain.Library.Collection", b =>
                {
                    b.Navigation("Items");
                });

            modelBuilder.Entity("TeleWave.Domain.Library.Genre", b =>
                {
                    b.Navigation("Aliases");
                });

            modelBuilder.Entity("TeleWave.Domain.Library.Show", b =>
                {
                    b.Navigation("Episodes");

                    b.Navigation("Genres");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.GridLayer", b =>
                {
                    b.Navigation("Slots");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.Group", b =>
                {
                    b.Navigation("Items");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.JunctionTemplate", b =>
                {
                    b.Navigation("Elements");
                });

            modelBuilder.Entity("TeleWave.Domain.Programming.ScheduleTemplate", b =>
                {
                    b.Navigation("Layers");
                });
#pragma warning restore 612, 618
        }
    }
}
