from django.contrib.auth.mixins import LoginRequiredMixin

from core.forms import GroupForm
from core.models import Group
from core.util import logs
from core.views.osint import OSINTListBase
from mixins.views import ObjectCreate, ObjectDelete, ObjectUpdate

log = logs.get_logger(__name__)


class GroupList(LoginRequiredMixin, OSINTListBase):
    osint_scope = "groups"
    model = Group
    page_title = "Groups"

    list_url_name = "groups"
    list_url_args = ["type"]

    submit_url_name = "group_create"


class GroupCreate(LoginRequiredMixin, ObjectCreate):
    model = Group
    form_class = GroupForm

    submit_url_name = "group_create"


class GroupUpdate(LoginRequiredMixin, ObjectUpdate):
    model = Group
    form_class = GroupForm

    submit_url_name = "group_update"


class GroupDelete(LoginRequiredMixin, ObjectDelete):
    model = Group
