from django.core.management.base import BaseCommand
from rooms.models import Room


class Command(BaseCommand):
    help = "Load all Perly Gate Residence room categories"

    def handle(self, *args, **options):
        rooms = [
            ("gate", "EXECUTIVE", 45000, "accommodation"),
            ("gate", "COMFORT ZONE", 50000, "accommodation"),
            ("gate", "TWIN BLISS", 55000, "accommodation"),
            ("gate", "ELEGANT SUITE", 55000, "accommodation"),
            ("gate", "BLISSFUL HEAVEN", 60000, "accommodation"),
            ("gate", "ROYAL SUITE", 65000, "accommodation"),
            ("gate", "MAJESTIC SUITE", 70000, "accommodation"),
            ("gate", "APARTMENT", 80000, "accommodation"),
            ("gate", "PARTY HOUSE", 100000, "event_space"),
            ("gate", "FAMILY APARTMENT", 150000, "accommodation"),
            ("gate", "PARTY PARADISE", 150000, "event_space"),
            ("gate", "CONFERENCE HALL", 200000, "event_space"),
            ("gate", "PRESIDENTIAL APARTMENT", 250000, "accommodation"),
            ("comfort", "CRYSTAL MANOR", 55000, "accommodation"),
            ("comfort", "CLASSIC HEAVEN", 55000, "accommodation"),
            ("comfort", "VELUET GROUE", 55000, "accommodation"),
            ("comfort", "SAPPHINE SUITE", 65000, "accommodation"),
            ("comfort", "DREAM SCAPE SUITE", 70000, "accommodation"),
        ]

        Room.objects.filter(building="gate", name__in=["CLASSIC", "CLASSIC PLUS"]).update(is_active=False)

        for building, name, price, room_type in rooms:
            Room.objects.update_or_create(
                building=building,
                name=name,
                defaults={
                    "price": price,
                    "room_type": room_type,
                    "is_active": True,
                },
            )

        self.stdout.write(
            self.style.SUCCESS("Loaded 18 room categories; Classic and Classic Plus are excluded.")
        )