// <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 PromotionService.Infrastructure;

#nullable disable

namespace PromotionService.Infrastructure.Migrations
{
    [DbContext(typeof(PromotionServiceContext))]
    [Migration("20260117144846_InitialCreate")]
    partial class InitialCreate
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "10.0.0")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("PromotionService.Domain.AggregatesModel.CampaignAggregate.Campaign", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<decimal>("AcquisitionPrice")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)")
                        .HasColumnName("acquisition_price");

                    b.Property<int>("AcquisitionTypeId")
                        .HasColumnType("integer")
                        .HasColumnName("acquisition_type_id");

                    b.Property<string>("BackingAssetCode")
                        .IsRequired()
                        .HasMaxLength(10)
                        .HasColumnType("character varying(10)")
                        .HasColumnName("backing_asset_code");

                    b.Property<int>("BackingAssetTypeId")
                        .HasColumnType("integer")
                        .HasColumnName("backing_asset_type_id");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("created_at");

                    b.Property<string>("Description")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)")
                        .HasColumnName("description");

                    b.Property<DateTime>("EndDate")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("end_date");

                    b.Property<decimal>("EscrowAmount")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)")
                        .HasColumnName("escrow_amount");

                    b.Property<Guid?>("EscrowHoldId")
                        .HasColumnType("uuid")
                        .HasColumnName("escrow_hold_id");

                    b.Property<Guid?>("EscrowWalletId")
                        .HasColumnType("uuid")
                        .HasColumnName("escrow_wallet_id");

                    b.Property<decimal>("FaceValue")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)")
                        .HasColumnName("face_value");

                    b.Property<int>("IssuedVouchers")
                        .HasColumnType("integer")
                        .HasColumnName("issued_vouchers");

                    b.Property<int>("MaxPerUser")
                        .HasColumnType("integer")
                        .HasColumnName("max_per_user");

                    b.Property<Guid>("MerchantId")
                        .HasColumnType("uuid")
                        .HasColumnName("merchant_id");

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

                    b.Property<DateTime>("StartDate")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("start_date");

                    b.Property<int>("StatusId")
                        .HasColumnType("integer")
                        .HasColumnName("status_id");

                    b.Property<int>("TotalVouchers")
                        .HasColumnType("integer")
                        .HasColumnName("total_vouchers");

                    b.Property<DateTime>("UpdatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("updated_at");

                    b.Property<int>("VoucherValidityDays")
                        .HasColumnType("integer")
                        .HasColumnName("voucher_validity_days");

                    b.HasKey("Id");

                    b.HasIndex("MerchantId")
                        .HasDatabaseName("ix_campaigns_merchant_id");

                    b.HasIndex("StatusId")
                        .HasDatabaseName("ix_campaigns_status_id");

                    b.HasIndex("StartDate", "EndDate")
                        .HasDatabaseName("ix_campaigns_date_range");

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

            modelBuilder.Entity("PromotionService.Domain.AggregatesModel.CampaignAggregate.Voucher", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<Guid>("CampaignId")
                        .HasColumnType("uuid")
                        .HasColumnName("campaign_id");

                    b.Property<DateTime?>("ClaimedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("claimed_at");

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasColumnName("code");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("created_at");

                    b.Property<DateTime?>("ExpiresAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("expires_at");

                    b.Property<decimal>("FaceValue")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)")
                        .HasColumnName("face_value");

                    b.Property<Guid?>("OwnerId")
                        .HasColumnType("uuid")
                        .HasColumnName("owner_id");

                    b.Property<DateTime?>("RedeemedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("redeemed_at");

                    b.Property<decimal>("RemainingValue")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)")
                        .HasColumnName("remaining_value");

                    b.Property<int>("StatusId")
                        .HasColumnType("integer")
                        .HasColumnName("status_id");

                    b.Property<DateTime>("UpdatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("updated_at");

                    b.HasKey("Id");

                    b.HasIndex("CampaignId")
                        .HasDatabaseName("ix_vouchers_campaign_id");

                    b.HasIndex("Code")
                        .IsUnique()
                        .HasDatabaseName("ix_vouchers_code");

                    b.HasIndex("OwnerId")
                        .HasDatabaseName("ix_vouchers_owner_id");

                    b.HasIndex("StatusId")
                        .HasDatabaseName("ix_vouchers_status_id");

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

            modelBuilder.Entity("PromotionService.Domain.AggregatesModel.RedemptionAggregate.Redemption", b =>
                {
                    b.Property<Guid>("Id")
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<decimal>("AmountRefunded")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)")
                        .HasColumnName("amount_refunded");

                    b.Property<decimal>("AmountUsed")
                        .HasPrecision(18, 2)
                        .HasColumnType("numeric(18,2)")
                        .HasColumnName("amount_used");

                    b.Property<Guid>("CampaignId")
                        .HasColumnType("uuid")
                        .HasColumnName("campaign_id");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("created_at");

                    b.Property<string>("ExecutionReference")
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)")
                        .HasColumnName("execution_reference");

                    b.Property<Guid?>("OrderId")
                        .HasColumnType("uuid")
                        .HasColumnName("order_id");

                    b.Property<DateTime>("RedeemedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("redeemed_at");

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

                    b.Property<Guid>("VoucherId")
                        .HasColumnType("uuid")
                        .HasColumnName("voucher_id");

                    b.HasKey("Id");

                    b.HasIndex("CampaignId")
                        .HasDatabaseName("ix_redemptions_campaign_id");

                    b.HasIndex("OrderId")
                        .HasDatabaseName("ix_redemptions_order_id");

                    b.HasIndex("UserId")
                        .HasDatabaseName("ix_redemptions_user_id");

                    b.HasIndex("VoucherId")
                        .HasDatabaseName("ix_redemptions_voucher_id");

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

            modelBuilder.Entity("PromotionService.Domain.AggregatesModel.CampaignAggregate.Voucher", b =>
                {
                    b.HasOne("PromotionService.Domain.AggregatesModel.CampaignAggregate.Campaign", null)
                        .WithMany("Vouchers")
                        .HasForeignKey("CampaignId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("PromotionService.Domain.AggregatesModel.CampaignAggregate.Campaign", b =>
                {
                    b.Navigation("Vouchers");
                });
#pragma warning restore 612, 618
        }
    }
}
