from django.contrib.auth.mixins import LoginRequiredMixin

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

log = logs.get_logger(__name__)


class ManipulationList(LoginRequiredMixin, OSINTListBase):
    osint_scope = "manipulations"
    model = Manipulation
    page_title = "Manipulations"

    list_url_name = "manipulations"
    list_url_args = ["type"]

    submit_url_name = "manipulation_create"


class ManipulationCreate(LoginRequiredMixin, ObjectCreate):
    model = Manipulation
    form_class = ManipulationForm

    submit_url_name = "manipulation_create"


class ManipulationUpdate(LoginRequiredMixin, ObjectUpdate):
    model = Manipulation
    form_class = ManipulationForm

    submit_url_name = "manipulation_update"


class ManipulationDelete(LoginRequiredMixin, ObjectDelete):
    model = Manipulation
