using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
    /// <inheritdoc />
    public partial class AddClubMembershipGiftValueConfiguration : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            // اضافه کردن تنظیمات Club.MembershipGiftValue
            migrationBuilder.Sql(@"
                INSERT INTO ""SystemConfigurations"" 
                (""Key"", ""Value"", ""Description"", ""Scope"", ""IsActive"", ""Created"", ""CreatedBy"")
                SELECT 
                    'Club.MembershipGiftValue',
                    '25200000',
                    'مبلغ هدیه حق عضویت باشگاه (ریال) - این مبلغ از کیف پول کم نمی‌شود',
                    1, -- ConfigurationScope.Club = 1
                    true,
                    NOW(),
                    'System'
                WHERE NOT EXISTS (
                    SELECT 1 FROM ""SystemConfigurations"" 
                    WHERE ""Key"" = 'Club.MembershipGiftValue'
                );
            ");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            // حذف تنظیمات Club.MembershipGiftValue
            migrationBuilder.Sql(@"
                DELETE FROM ""SystemConfigurations"" 
                WHERE ""Key"" = 'Club.MembershipGiftValue';
            ");
        }
    }
}
