using CMSMicroservice.Domain.Entities.Blog;
using CMSMicroservice.Domain.Entities.Content;
using CMSMicroservice.Domain.Entities.Payment;
using CMSMicroservice.Domain.Entities.Order;
using CMSMicroservice.Domain.Entities.DiscountShop;
using CMSMicroservice.Domain.Entities.Geography;
using Microsoft.EntityFrameworkCore.Infrastructure;

namespace CMSMicroservice.Application.Common.Interfaces;

public interface IApplicationDbContext
{
    DbSet<UserAddress> UserAddresses { get; }
    DbSet<Package> Packages { get; }
    DbSet<Role> Roles { get; }
    DbSet<Category> Categories { get; }
    DbSet<UserRole> UserRoles { get; }
    DbSet<UserCart> UserCarts { get; }
    DbSet<ProductGallery> ProductGalleries { get; }
    DbSet<FactorDetails> FactorDetails { get; }
    DbSet<Product> Products { get; }
    DbSet<ProductImage> ProductImages { get; }
    DbSet<User> Users { get; }
    DbSet<OtpToken> OtpTokens { get; }
    DbSet<Contract> Contracts { get; }
    DbSet<UserContract> UserContracts { get; }
    DbSet<Tag> Tags { get; }
    DbSet<ProductCategory> ProductCategories { get; }
    DbSet<ProductTag> ProductTags { get; }
    DbSet<Transaction> Transactions { get; }
    DbSet<UserOrder> UserOrders { get; }
    DbSet<OrderVAT> OrderVATs { get; }
    DbSet<UserPackagePurchase> UserPackagePurchases { get; }
    DbSet<UserWallet> UserWallets { get; }
    DbSet<UserWalletHistory> UserWalletHistories { get; }
    DbSet<ManualPayment> ManualPayments { get; }
    DbSet<PaymentTransaction> PaymentTransactions { get; }
    DbSet<PublicMessage> PublicMessages { get; }
    DbSet<ClubMembership> ClubMemberships { get; }
    DbSet<ClubMembershipHistory> ClubMembershipHistories { get; }
    DbSet<ClubMembershipCycle> ClubMembershipCycles { get; }
    DbSet<ClubMembershipCycleHistory> ClubMembershipCycleHistories { get; }
    DbSet<PackageHistory> PackageHistories { get; }
    DbSet<PackageFeature> PackageFeatures { get; }
    DbSet<ClubFeature> ClubFeatures { get; }
    DbSet<UserClubFeature> UserClubFeatures { get; }
    DbSet<NetworkWeeklyBalance> NetworkWeeklyBalances { get; }
    DbSet<NetworkMembershipHistory> NetworkMembershipHistories { get; }
    DbSet<WeekDefinition> WeekDefinitions { get; }
    DbSet<WeeklyCommissionPool> WeeklyCommissionPools { get; }
    DbSet<UserCommissionPayout> UserCommissionPayouts { get; }
    DbSet<CommissionPayoutHistory> CommissionPayoutHistories { get; }
    DbSet<WorkerExecutionLog> WorkerExecutionLogs { get; }
    DbSet<DayaLoanContract> DayaLoanContracts { get; }
    DbSet<AppVersion> AppVersions { get; }
    
    // ============= Discount Shop =============
    DbSet<DiscountProduct> DiscountProducts { get; }
    DbSet<DiscountCategory> DiscountCategories { get; }
    DbSet<DiscountProductCategory> DiscountProductCategories { get; }
    DbSet<DiscountProductImage> DiscountProductImages { get; }
    DbSet<DiscountShoppingCart> DiscountShoppingCarts { get; }
    DbSet<DiscountOrder> DiscountOrders { get; }
    DbSet<DiscountOrderDetail> DiscountOrderDetails { get; }
    
    // ============= Geography =============
    DbSet<Country> Countries { get; }
    DbSet<State> States { get; }
    DbSet<City> Cities { get; }
    
    // ============= Inventory Management =============
    DbSet<Warehouse> Warehouses { get; }
    DbSet<InventoryItem> InventoryItems { get; }
    DbSet<StockMovement> StockMovements { get; }
    
    // ============= Blog =============
    DbSet<BlogPost> BlogPosts { get; }
    DbSet<BlogCategory> BlogCategories { get; }
    DbSet<BlogPostCategory> BlogPostCategories { get; }
    DbSet<BlogPostTag> BlogPostTags { get; }
    DbSet<BlogPostImage> BlogPostImages { get; }
    
    // ============= Content Management =============
    DbSet<SitePage> SitePages { get; }
    DbSet<SitePageSection> SitePageSections { get; }
    
    // ============= Site Page Settings (Simplified) =============
    DbSet<SitePageSettings> SitePageSettingsEntities { get; }
    DbSet<SitePageImage> SitePageImages { get; }
    
    /// <summary>
    /// دسترسی به DatabaseFacade برای اجرای raw SQL و Stored Procedures
    /// </summary>
    DatabaseFacade Database { get; }
    
    Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
}