from django.contrib.auth.mixins import LoginRequiredMixin

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

log = logs.get_logger(__name__)


class PersonaList(LoginRequiredMixin, OSINTListBase):
    osint_scope = "personas"
    model = Persona
    page_title = "Personas"

    list_url_name = "personas"
    list_url_args = ["type"]

    submit_url_name = "persona_create"


class PersonaCreate(LoginRequiredMixin, ObjectCreate):
    model = Persona
    form_class = PersonaForm
    window_content = "mixins/window-content/persona-form.html"

    submit_url_name = "persona_create"


class PersonaUpdate(LoginRequiredMixin, ObjectUpdate):
    model = Persona
    form_class = PersonaForm
    window_content = "mixins/window-content/persona-form.html"

    submit_url_name = "persona_update"


class PersonaDelete(LoginRequiredMixin, ObjectDelete):
    model = Persona
