from django import forms

from .models import Comment

INPUT_CLASS = (
    "w-full rounded-xl bg-white/5 border border-white/10 px-4 py-3 text-sm text-neutral-100 "
    "placeholder-neutral-500 outline-none transition focus:border-brand-500 "
    "focus:ring-2 focus:ring-brand-500/30"
)


class CommentForm(forms.ModelForm):
    class Meta:
        model = Comment
        fields = ["name", "email", "website", "body"]
        widgets = {
            "name": forms.TextInput(attrs={"class": INPUT_CLASS, "placeholder": "Nama"}),
            "email": forms.EmailInput(
                attrs={"class": INPUT_CLASS, "placeholder": "Email (tidak dipublikasikan)"}
            ),
            "website": forms.URLInput(attrs={"class": INPUT_CLASS, "placeholder": "Website (opsional)"}),
            "body": forms.Textarea(
                attrs={"class": INPUT_CLASS, "rows": 4, "placeholder": "Tulis komentar..."}
            ),
        }
