//
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NostrStreamer.Database;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace NostrStreamer.Migrations
{
[DbContext(typeof(StreamerContext))]
partial class StreamerContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("NostrStreamer.Database.IngestEndpoint", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("App")
.IsRequired()
.HasColumnType("text");
b.Property>("Capabilities")
.IsRequired()
.HasColumnType("text[]");
b.Property("Cost")
.HasColumnType("integer");
b.Property("Forward")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("App")
.IsUnique();
b.ToTable("Endpoints");
});
modelBuilder.Entity("NostrStreamer.Database.Payment", b =>
{
b.Property("PaymentHash")
.HasColumnType("text");
b.Property("Amount")
.HasColumnType("numeric(20,0)");
b.Property("Created")
.HasColumnType("timestamp with time zone");
b.Property("Fee")
.HasColumnType("numeric(20,0)");
b.Property("Invoice")
.HasColumnType("text");
b.Property("IsPaid")
.HasColumnType("boolean");
b.Property("Nostr")
.HasColumnType("text");
b.Property("PubKey")
.IsRequired()
.HasColumnType("text");
b.Property("Type")
.HasColumnType("integer");
b.HasKey("PaymentHash");
b.HasIndex("PubKey");
b.ToTable("Payments");
});
modelBuilder.Entity("NostrStreamer.Database.PushSubscription", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Auth")
.IsRequired()
.HasColumnType("text");
b.Property("Created")
.HasColumnType("timestamp with time zone");
b.Property("Endpoint")
.IsRequired()
.HasColumnType("text");
b.Property("Key")
.IsRequired()
.HasColumnType("text");
b.Property("LastUsed")
.HasColumnType("timestamp with time zone");
b.Property("Pubkey")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("Scope")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("PushSubscriptions");
});
modelBuilder.Entity("NostrStreamer.Database.PushSubscriptionTarget", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("SubscriberPubkey")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("TargetPubkey")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.HasKey("Id");
b.HasIndex("TargetPubkey");
b.HasIndex("SubscriberPubkey", "TargetPubkey")
.IsUnique();
b.ToTable("PushSubscriptionTargets");
});
modelBuilder.Entity("NostrStreamer.Database.StreamTickets", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Created")
.HasColumnType("timestamp with time zone");
b.Property("Token")
.HasColumnType("uuid");
b.Property("UserStreamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserStreamId");
b.ToTable("StreamTickets");
});
modelBuilder.Entity("NostrStreamer.Database.User", b =>
{
b.Property("PubKey")
.HasColumnType("text");
b.Property("Balance")
.HasColumnType("bigint");
b.Property("ContentWarning")
.HasColumnType("text");
b.Property("Goal")
.HasColumnType("text");
b.Property("Image")
.HasColumnType("text");
b.Property("IsAdmin")
.HasColumnType("boolean");
b.Property("IsBlocked")
.HasColumnType("boolean");
b.Property("StreamKey")
.IsRequired()
.HasColumnType("text");
b.Property("Summary")
.HasColumnType("text");
b.Property("Tags")
.HasColumnType("text");
b.Property("Title")
.HasColumnType("text");
b.Property("TosAccepted")
.HasColumnType("timestamp with time zone");
b.Property("Version")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("xid")
.HasColumnName("xmin");
b.HasKey("PubKey");
b.ToTable("Users");
});
modelBuilder.Entity("NostrStreamer.Database.UserStream", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AdmissionCost")
.HasColumnType("numeric");
b.Property("ContentWarning")
.HasColumnType("text");
b.Property("EdgeIp")
.IsRequired()
.HasColumnType("text");
b.Property("EndpointId")
.HasColumnType("uuid");
b.Property("Ends")
.HasColumnType("timestamp with time zone");
b.Property("Event")
.IsRequired()
.HasColumnType("text");
b.Property("ForwardClientId")
.IsRequired()
.HasColumnType("text");
b.Property("Goal")
.HasColumnType("text");
b.Property("Image")
.HasColumnType("text");
b.Property("LastSegment")
.HasColumnType("timestamp with time zone");
b.Property("Length")
.HasColumnType("numeric");
b.Property("MilliSatsCollected")
.HasColumnType("numeric");
b.Property("PubKey")
.IsRequired()
.HasColumnType("text");
b.Property("Starts")
.HasColumnType("timestamp with time zone");
b.Property("State")
.HasColumnType("integer");
b.Property("Summary")
.HasColumnType("text");
b.Property("Tags")
.HasColumnType("text");
b.Property("Thumbnail")
.HasColumnType("text");
b.Property("Title")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("EndpointId");
b.HasIndex("PubKey");
b.ToTable("Streams");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamClip", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Created")
.HasColumnType("timestamp with time zone");
b.Property("TakenByPubkey")
.IsRequired()
.HasColumnType("text");
b.Property("Url")
.IsRequired()
.HasColumnType("text");
b.Property("UserStreamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserStreamId");
b.ToTable("Clips");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamForwards", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Target")
.IsRequired()
.HasColumnType("text");
b.Property("UserPubkey")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserPubkey");
b.ToTable("Forwards");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamGuest", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("PubKey")
.IsRequired()
.HasColumnType("text");
b.Property("Relay")
.HasColumnType("text");
b.Property("Role")
.HasColumnType("text");
b.Property("Sig")
.HasColumnType("text");
b.Property("StreamId")
.HasColumnType("uuid");
b.Property("ZapSplit")
.HasColumnType("numeric");
b.HasKey("Id");
b.HasIndex("StreamId", "PubKey")
.IsUnique();
b.ToTable("Guests");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamKey", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Created")
.HasColumnType("timestamp with time zone");
b.Property("Expires")
.HasColumnType("timestamp with time zone");
b.Property("Key")
.IsRequired()
.HasColumnType("text");
b.Property("StreamId")
.HasColumnType("uuid");
b.Property("UserPubkey")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("StreamId")
.IsUnique();
b.HasIndex("UserPubkey");
b.ToTable("StreamKeys");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamRecording", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Duration")
.HasColumnType("double precision");
b.Property("Timestamp")
.HasColumnType("timestamp with time zone");
b.Property("Url")
.IsRequired()
.HasColumnType("text");
b.Property("UserStreamId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserStreamId");
b.ToTable("Recordings");
});
modelBuilder.Entity("NostrStreamer.Database.Payment", b =>
{
b.HasOne("NostrStreamer.Database.User", "User")
.WithMany("Payments")
.HasForeignKey("PubKey")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("NostrStreamer.Database.StreamTickets", b =>
{
b.HasOne("NostrStreamer.Database.UserStream", "UserStream")
.WithMany()
.HasForeignKey("UserStreamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UserStream");
});
modelBuilder.Entity("NostrStreamer.Database.UserStream", b =>
{
b.HasOne("NostrStreamer.Database.IngestEndpoint", "Endpoint")
.WithMany()
.HasForeignKey("EndpointId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("NostrStreamer.Database.User", "User")
.WithMany("Streams")
.HasForeignKey("PubKey")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Endpoint");
b.Navigation("User");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamClip", b =>
{
b.HasOne("NostrStreamer.Database.UserStream", "UserStream")
.WithMany()
.HasForeignKey("UserStreamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UserStream");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamForwards", b =>
{
b.HasOne("NostrStreamer.Database.User", "User")
.WithMany("Forwards")
.HasForeignKey("UserPubkey")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamGuest", b =>
{
b.HasOne("NostrStreamer.Database.UserStream", "Stream")
.WithMany("Guests")
.HasForeignKey("StreamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stream");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamKey", b =>
{
b.HasOne("NostrStreamer.Database.UserStream", "UserStream")
.WithOne("StreamKey")
.HasForeignKey("NostrStreamer.Database.UserStreamKey", "StreamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("NostrStreamer.Database.User", "User")
.WithMany("StreamKeys")
.HasForeignKey("UserPubkey")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
b.Navigation("UserStream");
});
modelBuilder.Entity("NostrStreamer.Database.UserStreamRecording", b =>
{
b.HasOne("NostrStreamer.Database.UserStream", "Stream")
.WithMany("Recordings")
.HasForeignKey("UserStreamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Stream");
});
modelBuilder.Entity("NostrStreamer.Database.User", b =>
{
b.Navigation("Forwards");
b.Navigation("Payments");
b.Navigation("StreamKeys");
b.Navigation("Streams");
});
modelBuilder.Entity("NostrStreamer.Database.UserStream", b =>
{
b.Navigation("Guests");
b.Navigation("Recordings");
b.Navigation("StreamKey");
});
#pragma warning restore 612, 618
}
}
}