# hosting_app/admin.py

from django.contrib import admin
from django.utils import timezone

from .models import (
    ApprovalStatus,
    PublicListingStatus,
    BookingRequestStatus,
    QuotationStatus,
    HostProfile,
    HostVenue,
    HostVenueImage,
    HostEventPackage,
    HostPackageInclusion,
    HostMealPlan,
    HostAddOnService,
    HostBookingRequest,
    HostBookingRequestAddOn,
    HostBookingQuotation,
    HostBankingDetails,
    HostingPartnerGuidanceResource,
)


# ============================================================
# Admin Actions
# ============================================================

@admin.action(description="Mark selected items as Approved")
def mark_as_approved(modeladmin, request, queryset):
    update_fields = {
        "status": ApprovalStatus.APPROVED,
        "approved_at": timezone.now(),
    }

    # Only update fields that exist on the model
    valid_fields = {
        field.name for field in queryset.model._meta.fields
    }

    final_update = {
        key: value for key, value in update_fields.items()
        if key in valid_fields
    }

    queryset.update(**final_update)


@admin.action(description="Mark selected listings as Public Approved")
def mark_listing_as_approved(modeladmin, request, queryset):
    queryset.update(
        listing_status=PublicListingStatus.APPROVED,
        approved_at=timezone.now(),
        is_active=True,
    )


@admin.action(description="Mark selected listings as Pending Review")
def mark_listing_as_pending_review(modeladmin, request, queryset):
    queryset.update(
        listing_status=PublicListingStatus.PENDING_REVIEW
    )


@admin.action(description="Mark selected listings as Hidden")
def mark_listing_as_hidden(modeladmin, request, queryset):
    queryset.update(
        listing_status=PublicListingStatus.HIDDEN
    )


@admin.action(description="Make selected items Featured")
def make_featured(modeladmin, request, queryset):
    queryset.update(is_featured=True)


@admin.action(description="Remove Featured status")
def remove_featured(modeladmin, request, queryset):
    queryset.update(is_featured=False)


@admin.action(description="Activate selected items")
def activate_items(modeladmin, request, queryset):
    queryset.update(is_active=True)


@admin.action(description="Deactivate selected items")
def deactivate_items(modeladmin, request, queryset):
    queryset.update(is_active=False)


# ============================================================
# Inlines
# ============================================================

class HostBankingDetailsInline(admin.StackedInline):
    model = HostBankingDetails
    extra = 0
    max_num = 1
    can_delete = True

    fieldsets = (
        ("Bank Account Details", {
            "fields": (
                "account_holder_name",
                "bank_name",
                "branch_name",
                "account_number",
                "iban",
                "swift_code",
                "bank_country",
                "bank_address",
            )
        }),
        ("Verification / Notes", {
            "fields": (
                "is_verified",
                "payment_notes",
                "admin_review_note",
            )
        }),
        ("System Dates", {
            "fields": (
                "created_at",
                "updated_at",
            )
        }),
    )

    readonly_fields = (
        "created_at",
        "updated_at",
    )


class HostVenueImageInline(admin.TabularInline):
    model = HostVenueImage
    extra = 1

    fields = (
        "image",
        "caption",
        "display_order",
        "created_at",
    )

    readonly_fields = (
        "created_at",
    )


class HostPackageInclusionInline(admin.TabularInline):
    model = HostPackageInclusion
    extra = 1

    fields = (
        "inclusion_text",
        "display_order",
    )


class HostEventPackageInline(admin.TabularInline):
    model = HostEventPackage
    extra = 0
    show_change_link = True

    fields = (
        "title",
        "event_type",
        "base_price_usd",
        "duration_hours",
        "max_people_included",
        "listing_status",
        "is_active",
        "is_featured",
    )


class HostMealPlanInline(admin.TabularInline):
    model = HostMealPlan
    extra = 0
    show_change_link = True

    fields = (
        "title",
        "price_per_person_usd",
        "minimum_people",
        "listing_status",
        "is_active",
        "is_featured",
    )


class HostAddOnServiceInline(admin.TabularInline):
    model = HostAddOnService
    extra = 0
    show_change_link = True

    fields = (
        "title",
        "pricing_type",
        "price_usd",
        "listing_status",
        "is_active",
        "is_featured",
    )


class HostBookingRequestAddOnInline(admin.TabularInline):
    model = HostBookingRequestAddOn
    extra = 0

    fields = (
        "add_on_service",
        "add_on_title_snapshot",
        "quantity",
        "unit_price_snapshot_usd",
        "subtotal_snapshot_usd",
        "created_at",
    )

    readonly_fields = (
        "created_at",
    )

    autocomplete_fields = (
        "add_on_service",
    )


class HostBookingQuotationInline(admin.TabularInline):
    model = HostBookingQuotation
    extra = 0
    show_change_link = True

    fields = (
        "status",
        "prepared_by",
        "final_guest_payable_amount_usd",
        "ensolanka_commission_usd",
        "host_net_amount_usd",
        "payment_due_date",
        "created_at",
    )

    readonly_fields = (
        "created_at",
    )

    autocomplete_fields = (
        "prepared_by",
    )


# ============================================================
# 1. Host Profile Admin
# ============================================================

@admin.register(HostProfile)
class HostProfileAdmin(admin.ModelAdmin):
    list_display = (
        "business_name",
        "contact_person_name",
        "email",
        "phone_number",
        "status",
        "is_featured",
        "is_active",
        "approved_at",
        "created_at",
    )

    list_filter = (
        "status",
        "is_featured",
        "is_active",
        "created_at",
        "approved_at",
    )

    search_fields = (
        "business_name",
        "contact_person_name",
        "email",
        "phone_number",
        "whatsapp_number",
        "user__username",
        "user__email",
    )

    readonly_fields = (
        "approved_at",
        "created_at",
        "updated_at",
    )

    autocomplete_fields = (
        "user",
    )

    ordering = (
        "-created_at",
    )

    actions = (
        mark_as_approved,
        make_featured,
        remove_featured,
        activate_items,
        deactivate_items,
    )

    inlines = (
        HostBankingDetailsInline,
    )

    fieldsets = (
        ("Linked User", {
            "fields": (
                "user",
            )
        }),
        ("Business / Contact Details", {
            "fields": (
                "business_name",
                "contact_person_name",
                "email",
                "phone_number",
                "whatsapp_number",
                "profile_image",
                "short_introduction",
            )
        }),
        ("Admin Approval / Visibility", {
            "fields": (
                "status",
                "is_featured",
                "is_active",
                "admin_review_note",
                "approved_at",
            )
        }),
        ("System Dates", {
            "fields": (
                "created_at",
                "updated_at",
            )
        }),
    )


# ============================================================
# 2. Host Venue Admin
# ============================================================

@admin.register(HostVenue)
class HostVenueAdmin(admin.ModelAdmin):
    list_display = (
        "venue_name",
        "host_profile",
        "venue_category",
        "district",
        "city",
        "max_guest_capacity",
        "listing_status",
        "is_public",
        "is_featured",
        "approved_at",
        "created_at",
    )

    list_filter = (
        "venue_category",
        "district",
        "city",
        "listing_status",
        "is_public",
        "is_featured",
        "meal_service_available",
        "alcohol_available",
        "decoration_available",
        "indoor_available",
        "outdoor_available",
        "private_area_available",
        "parking_available",
        "created_at",
    )

    search_fields = (
        "venue_name",
        "short_description",
        "full_description",
        "host_profile__business_name",
        "host_profile__contact_person_name",
        "district",
        "city",
        "address",
    )

    readonly_fields = (
        "slug",
        "approved_at",
        "created_at",
        "updated_at",
    )

    autocomplete_fields = (
        "host_profile",
    )

    ordering = (
        "-is_featured",
        "-created_at",
    )

    actions = (
        mark_listing_as_approved,
        mark_listing_as_pending_review,
        mark_listing_as_hidden,
        make_featured,
        remove_featured,
    )

    inlines = (
        HostVenueImageInline,
        HostEventPackageInline,
        HostMealPlanInline,
        HostAddOnServiceInline,
    )

    fieldsets = (
        ("Host / Basic Venue Details", {
            "fields": (
                "host_profile",
                "venue_name",
                "slug",
                "venue_category",
                "short_description",
                "full_description",
                "cover_image",
            )
        }),
        ("Location Details", {
            "fields": (
                "district",
                "city",
                "address",
                "google_map_link",
            )
        }),
        ("Capacity", {
            "fields": (
                "max_guest_capacity",
            )
        }),
        ("Event Suitability", {
            "fields": (
                "supports_romantic_dates",
                "supports_proposal_events",
                "supports_anniversaries",
                "supports_birthdays",
                "supports_honeymoon_experiences",
                "supports_private_dinners",
                "supports_engagement_events",
                "supports_small_weddings",
                "supports_custom_celebrations",
            )
        }),
        ("Facilities / Capabilities", {
            "fields": (
                "meal_service_available",
                "alcohol_available",
                "decoration_available",
                "photography_allowed",
                "music_allowed",
                "indoor_available",
                "outdoor_available",
                "private_area_available",
                "parking_available",
            )
        }),
        ("Important Notes", {
            "fields": (
                "important_notes",
            )
        }),
        ("Admin Approval / Public Visibility", {
            "fields": (
                "listing_status",
                "is_public",
                "is_featured",
                "admin_review_note",
                "approved_at",
            )
        }),
        ("System Dates", {
            "fields": (
                "created_at",
                "updated_at",
            )
        }),
    )


# ============================================================
# 3. Host Venue Image Admin
# ============================================================

@admin.register(HostVenueImage)
class HostVenueImageAdmin(admin.ModelAdmin):
    list_display = (
        "venue",
        "caption",
        "display_order",
        "created_at",
    )

    list_filter = (
        "created_at",
    )

    search_fields = (
        "venue__venue_name",
        "caption",
    )

    readonly_fields = (
        "created_at",
    )

    autocomplete_fields = (
        "venue",
    )

    ordering = (
        "display_order",
        "id",
    )


# ============================================================
# 4. Host Event Package Admin
# ============================================================

@admin.register(HostEventPackage)
class HostEventPackageAdmin(admin.ModelAdmin):
    list_display = (
        "title",
        "venue",
        "event_type",
        "base_price_usd",
        "duration_hours",
        "max_people_included",
        "is_active",
        "is_featured",
        "listing_status",
        "approved_at",
        "created_at",
    )

    list_filter = (
        "event_type",
        "listing_status",
        "is_active",
        "is_featured",
        "includes_meals",
        "includes_decoration",
        "includes_photography",
        "includes_music",
        "is_customizable",
        "created_at",
    )

    search_fields = (
        "title",
        "short_description",
        "full_description",
        "venue__venue_name",
        "venue__host_profile__business_name",
    )

    readonly_fields = (
        "slug",
        "approved_at",
        "created_at",
        "updated_at",
    )

    autocomplete_fields = (
        "venue",
    )

    ordering = (
        "-is_featured",
        "-created_at",
    )

    actions = (
        mark_listing_as_approved,
        mark_listing_as_pending_review,
        mark_listing_as_hidden,
        make_featured,
        remove_featured,
        activate_items,
        deactivate_items,
    )

    inlines = (
        HostPackageInclusionInline,
    )

    fieldsets = (
        ("Package Basic Details", {
            "fields": (
                "venue",
                "title",
                "slug",
                "event_type",
                "short_description",
                "full_description",
                "package_image",
            )
        }),
        ("Pricing / Capacity", {
            "fields": (
                "duration_hours",
                "base_price_usd",
                "max_people_included",
                "extra_person_price_usd",
            )
        }),
        ("Included Features", {
            "fields": (
                "includes_meals",
                "includes_decoration",
                "includes_photography",
                "includes_music",
                "is_customizable",
            )
        }),
        ("Package Notes", {
            "fields": (
                "inclusions_summary",
                "exclusions_summary",
                "pricing_note",
            )
        }),
        ("Admin Approval / Visibility", {
            "fields": (
                "listing_status",
                "is_active",
                "is_featured",
                "admin_review_note",
                "approved_at",
            )
        }),
        ("System Dates", {
            "fields": (
                "created_at",
                "updated_at",
            )
        }),
    )


# ============================================================
# 5. Host Package Inclusion Admin
# ============================================================

@admin.register(HostPackageInclusion)
class HostPackageInclusionAdmin(admin.ModelAdmin):
    list_display = (
        "inclusion_text",
        "package",
        "display_order",
    )

    list_filter = (
        "package__event_type",
        "package__listing_status",
    )

    search_fields = (
        "inclusion_text",
        "package__title",
        "package__venue__venue_name",
    )

    autocomplete_fields = (
        "package",
    )

    ordering = (
        "display_order",
        "id",
    )


# ============================================================
# 6. Host Meal Plan Admin
# ============================================================

@admin.register(HostMealPlan)
class HostMealPlanAdmin(admin.ModelAdmin):
    list_display = (
        "title",
        "venue",
        "price_per_person_usd",
        "minimum_people",
        "is_active",
        "is_featured",
        "listing_status",
        "approved_at",
        "created_at",
    )

    list_filter = (
        "listing_status",
        "is_active",
        "is_featured",
        "created_at",
    )

    search_fields = (
        "title",
        "description",
        "venue__venue_name",
        "venue__host_profile__business_name",
    )

    readonly_fields = (
        "approved_at",
        "created_at",
        "updated_at",
    )

    autocomplete_fields = (
        "venue",
    )

    ordering = (
        "-is_featured",
        "title",
    )

    actions = (
        mark_listing_as_approved,
        mark_listing_as_pending_review,
        mark_listing_as_hidden,
        make_featured,
        remove_featured,
        activate_items,
        deactivate_items,
    )

    fieldsets = (
        ("Meal Plan Details", {
            "fields": (
                "venue",
                "title",
                "description",
                "meal_image",
            )
        }),
        ("Pricing", {
            "fields": (
                "price_per_person_usd",
                "minimum_people",
            )
        }),
        ("Admin Approval / Visibility", {
            "fields": (
                "listing_status",
                "is_active",
                "is_featured",
                "admin_review_note",
                "approved_at",
            )
        }),
        ("System Dates", {
            "fields": (
                "created_at",
                "updated_at",
            )
        }),
    )


# ============================================================
# 7. Host Add-On Service Admin
# ============================================================

@admin.register(HostAddOnService)
class HostAddOnServiceAdmin(admin.ModelAdmin):
    list_display = (
        "title",
        "venue",
        "pricing_type",
        "price_usd",
        "is_active",
        "is_featured",
        "listing_status",
        "approved_at",
        "created_at",
    )

    list_filter = (
        "pricing_type",
        "listing_status",
        "is_active",
        "is_featured",
        "created_at",
    )

    search_fields = (
        "title",
        "description",
        "venue__venue_name",
        "venue__host_profile__business_name",
    )

    readonly_fields = (
        "approved_at",
        "created_at",
        "updated_at",
    )

    autocomplete_fields = (
        "venue",
    )

    ordering = (
        "-is_featured",
        "title",
    )

    actions = (
        mark_listing_as_approved,
        mark_listing_as_pending_review,
        mark_listing_as_hidden,
        make_featured,
        remove_featured,
        activate_items,
        deactivate_items,
    )

    fieldsets = (
        ("Add-On Details", {
            "fields": (
                "venue",
                "title",
                "description",
                "add_on_image",
            )
        }),
        ("Pricing", {
            "fields": (
                "pricing_type",
                "price_usd",
            )
        }),
        ("Admin Approval / Visibility", {
            "fields": (
                "listing_status",
                "is_active",
                "is_featured",
                "admin_review_note",
                "approved_at",
            )
        }),
        ("System Dates", {
            "fields": (
                "created_at",
                "updated_at",
            )
        }),
    )


# ============================================================
# 8. Host Booking Request Admin
# ============================================================

@admin.register(HostBookingRequest)
class HostBookingRequestAdmin(admin.ModelAdmin):
    list_display = (
        "id",
        "guest_profile",
        "venue",
        "event_type",
        "preferred_event_date",
        "preferred_start_time",
        "number_of_guests",
        "status",
        "submitted_at",
        "updated_at",
    )

    list_filter = (
        "event_type",
        "status",
        "preferred_event_date",
        "submitted_at",
        "guest_confirmed_at",
        "paid_at",
        "completed_at",
    )

    search_fields = (
        "id",
        "guest_profile__user__username",
        "guest_profile__user__email",
        "venue__venue_name",
        "venue__host_profile__business_name",
        "occasion_title",
        "occasion_note",
        "special_requests",
    )

    readonly_fields = (
        "submitted_at",
        "guest_confirmed_at",
        "paid_at",
        "completed_at",
        "updated_at",
    )

    autocomplete_fields = (
        "guest_profile",
        "venue",
        "selected_package",
        "selected_meal_plan",
    )

    date_hierarchy = "preferred_event_date"

    ordering = (
        "-submitted_at",
    )

    inlines = (
        HostBookingRequestAddOnInline,
        HostBookingQuotationInline,
    )

    fieldsets = (
        ("Guest / Venue Selection", {
            "fields": (
                "guest_profile",
                "venue",
                "selected_package",
                "selected_meal_plan",
            )
        }),
        ("Event Details", {
            "fields": (
                "event_type",
                "preferred_event_date",
                "preferred_start_time",
                "expected_duration_hours",
                "number_of_guests",
                "occasion_title",
                "occasion_note",
                "special_requests",
            )
        }),
        ("Status / Coordination", {
            "fields": (
                "status",
                "admin_review_note",
                "host_coordination_note",
            )
        }),
        ("Important Dates", {
            "fields": (
                "submitted_at",
                "guest_confirmed_at",
                "paid_at",
                "completed_at",
                "updated_at",
            )
        }),
    )

    actions = (
        "mark_under_review",
        "mark_waiting_host_confirmation",
        "mark_quotation_ready",
        "mark_guest_confirmed",
        "mark_payment_due",
        "mark_paid",
        "mark_arranging",
        "mark_completed",
        "mark_cancelled",
        "mark_rejected",
    )

    @admin.action(description="Mark as Under Review")
    def mark_under_review(self, request, queryset):
        queryset.update(status=BookingRequestStatus.UNDER_REVIEW)

    @admin.action(description="Mark as Waiting for Host Confirmation")
    def mark_waiting_host_confirmation(self, request, queryset):
        queryset.update(status=BookingRequestStatus.WAITING_HOST_CONFIRMATION)

    @admin.action(description="Mark as Quotation Ready")
    def mark_quotation_ready(self, request, queryset):
        queryset.update(status=BookingRequestStatus.QUOTATION_READY)

    @admin.action(description="Mark as Guest Confirmed")
    def mark_guest_confirmed(self, request, queryset):
        queryset.update(
            status=BookingRequestStatus.GUEST_CONFIRMED,
            guest_confirmed_at=timezone.now(),
        )

    @admin.action(description="Mark as Payment Due")
    def mark_payment_due(self, request, queryset):
        queryset.update(status=BookingRequestStatus.PAYMENT_DUE)

    @admin.action(description="Mark as Paid")
    def mark_paid(self, request, queryset):
        queryset.update(
            status=BookingRequestStatus.PAID,
            paid_at=timezone.now(),
        )

    @admin.action(description="Mark as Arranging")
    def mark_arranging(self, request, queryset):
        queryset.update(status=BookingRequestStatus.ARRANGING)

    @admin.action(description="Mark as Completed")
    def mark_completed(self, request, queryset):
        queryset.update(
            status=BookingRequestStatus.COMPLETED,
            completed_at=timezone.now(),
        )

    @admin.action(description="Mark as Cancelled")
    def mark_cancelled(self, request, queryset):
        queryset.update(status=BookingRequestStatus.CANCELLED)

    @admin.action(description="Mark as Rejected")
    def mark_rejected(self, request, queryset):
        queryset.update(status=BookingRequestStatus.REJECTED)


# ============================================================
# 9. Host Booking Request Add-On Admin
# ============================================================

@admin.register(HostBookingRequestAddOn)
class HostBookingRequestAddOnAdmin(admin.ModelAdmin):
    list_display = (
        "booking_request",
        "add_on_title_snapshot",
        "quantity",
        "unit_price_snapshot_usd",
        "subtotal_snapshot_usd",
        "created_at",
    )

    list_filter = (
        "created_at",
    )

    search_fields = (
        "booking_request__id",
        "add_on_title_snapshot",
        "add_on_service__title",
        "booking_request__venue__venue_name",
    )

    readonly_fields = (
        "created_at",
    )

    autocomplete_fields = (
        "booking_request",
        "add_on_service",
    )

    ordering = (
        "id",
    )


# ============================================================
# 10. Host Booking Quotation Admin
# ============================================================

@admin.register(HostBookingQuotation)
class HostBookingQuotationAdmin(admin.ModelAdmin):
    list_display = (
        "id",
        "booking_request",
        "prepared_by",
        "status",
        "final_guest_payable_amount_usd",
        "commission_rate_percent",
        "ensolanka_commission_usd",
        "host_net_amount_usd",
        "payment_due_date",
        "created_at",
    )

    list_filter = (
        "status",
        "payment_due_date",
        "sent_to_guest_at",
        "accepted_at",
        "created_at",
    )

    search_fields = (
        "id",
        "booking_request__id",
        "booking_request__venue__venue_name",
        "booking_request__guest_profile__user__username",
        "booking_request__guest_profile__user__email",
        "quotation_note_to_guest",
        "internal_note",
    )

    readonly_fields = (
        "sent_to_guest_at",
        "accepted_at",
        "created_at",
        "updated_at",
    )

    autocomplete_fields = (
        "booking_request",
        "prepared_by",
    )

    ordering = (
        "-created_at",
    )

    actions = (
        "mark_sent_to_guest",
        "mark_accepted",
        "mark_expired",
        "mark_cancelled",
    )

    fieldsets = (
        ("Booking / Staff Details", {
            "fields": (
                "booking_request",
                "prepared_by",
            )
        }),
        ("Pricing Snapshot", {
            "fields": (
                "package_amount_usd",
                "meal_amount_usd",
                "add_on_amount_usd",
                "manual_adjustment_usd",
                "final_guest_payable_amount_usd",
            )
        }),
        ("Commission / Host Net Amount", {
            "fields": (
                "commission_rate_percent",
                "ensolanka_commission_usd",
                "host_net_amount_usd",
            )
        }),
        ("Quotation Status / Dates", {
            "fields": (
                "status",
                "payment_due_date",
                "sent_to_guest_at",
                "accepted_at",
            )
        }),
        ("Notes", {
            "fields": (
                "quotation_note_to_guest",
                "internal_note",
            )
        }),
        ("System Dates", {
            "fields": (
                "created_at",
                "updated_at",
            )
        }),
    )

    @admin.action(description="Mark as Sent to Guest")
    def mark_sent_to_guest(self, request, queryset):
        queryset.update(
            status=QuotationStatus.SENT_TO_GUEST,
            sent_to_guest_at=timezone.now(),
        )

    @admin.action(description="Mark as Accepted")
    def mark_accepted(self, request, queryset):
        queryset.update(
            status=QuotationStatus.ACCEPTED,
            accepted_at=timezone.now(),
        )

    @admin.action(description="Mark as Expired")
    def mark_expired(self, request, queryset):
        queryset.update(status=QuotationStatus.EXPIRED)

    @admin.action(description="Mark as Cancelled")
    def mark_cancelled(self, request, queryset):
        queryset.update(status=QuotationStatus.CANCELLED)


# ============================================================
# 11. Host Banking Details Admin
# ============================================================

@admin.register(HostBankingDetails)
class HostBankingDetailsAdmin(admin.ModelAdmin):
    list_display = (
        "host_profile",
        "account_holder_name",
        "bank_name",
        "branch_name",
        "bank_country",
        "is_verified",
        "created_at",
        "updated_at",
    )

    list_filter = (
        "is_verified",
        "bank_country",
        "bank_name",
        "created_at",
    )

    search_fields = (
        "host_profile__business_name",
        "host_profile__contact_person_name",
        "account_holder_name",
        "bank_name",
        "branch_name",
        "account_number",
        "iban",
        "swift_code",
    )

    readonly_fields = (
        "created_at",
        "updated_at",
    )

    autocomplete_fields = (
        "host_profile",
    )

    ordering = (
        "-created_at",
    )

    actions = (
        "mark_verified",
        "mark_unverified",
    )

    fieldsets = (
        ("Host", {
            "fields": (
                "host_profile",
            )
        }),
        ("Bank Account Details", {
            "fields": (
                "account_holder_name",
                "bank_name",
                "branch_name",
                "account_number",
                "iban",
                "swift_code",
                "bank_country",
                "bank_address",
            )
        }),
        ("Verification / Notes", {
            "fields": (
                "is_verified",
                "payment_notes",
                "admin_review_note",
            )
        }),
        ("System Dates", {
            "fields": (
                "created_at",
                "updated_at",
            )
        }),
    )

    @admin.action(description="Mark selected banking details as Verified")
    def mark_verified(self, request, queryset):
        queryset.update(is_verified=True)

    @admin.action(description="Mark selected banking details as Not Verified")
    def mark_unverified(self, request, queryset):
        queryset.update(is_verified=False)

@admin.register(HostingPartnerGuidanceResource)
class HostingPartnerGuidanceResourceAdmin(admin.ModelAdmin):
    list_display = (
        'language',
        'title',
        'is_active',
        'created_at',
        'updated_at',
    )

    list_filter = (
        'language',
        'is_active',
        'created_at',
    )

    search_fields = (
        'title',
        'description',
    )

    readonly_fields = (
        'created_at',
        'updated_at',
    )

    fieldsets = (
        ('Language & Title', {
            'fields': (
                'language',
                'title',
                'description',
                'is_active',
            )
        }),
        ('Guidance Documents', {
            'fields': (
                'full_playbook_pdf',
                'summary_overview_pdf',
            )
        }),
        ('Audio & Video Guidance', {
            'fields': (
                'audio_guide_file',
                'youtube_video_link',
            )
        }),
        ('System Information', {
            'fields': (
                'created_at',
                'updated_at',
            )
        }),
    )