from django.contrib.auth.mixins import LoginRequiredMixin

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

log = logs.get_logger(__name__)


class PersonList(LoginRequiredMixin, OSINTListBase):
    osint_scope = "people"
    model = Person
    page_title = "People"

    list_url_name = "people"
    list_url_args = ["type"]

    submit_url_name = "person_create"


class PersonCreate(LoginRequiredMixin, ObjectCreate):
    model = Person
    form_class = PersonForm

    submit_url_name = "person_create"


class PersonUpdate(LoginRequiredMixin, ObjectUpdate):
    model = Person
    form_class = PersonForm
    window_content = "mixins/window-content/person-form.html"

    submit_url_name = "person_update"


class PersonDelete(LoginRequiredMixin, ObjectDelete):
    model = Person
