from core.clients import transport
from core.views.signal import Signal, SignalAccountAdd, SignalAccounts


class Instagram(Signal):
    service = "instagram"
    page_title = "Instagram"
    accounts_url_name = "instagram_accounts"


class InstagramAccounts(SignalAccounts):
    service = "instagram"
    context_object_name_singular = "Instagram Account"
    context_object_name = "Instagram Accounts"
    list_url_name = "instagram_accounts"

    def get_queryset(self, **kwargs):
        self.extra_context = self._service_context(
            service="instagram",
            label="Instagram",
            add_url_name="instagram_account_add",
            show_contact_actions=False,
        )
        return self._normalize_accounts(transport.list_accounts("instagram"))


class InstagramAccountAdd(SignalAccountAdd):
    service = "instagram"
    detail_url_name = "instagram_account_add"
