from django import forms
from .models import Coupon
from .models import ShippingAddress

class GuestCheckoutForm(forms.Form):
    email = forms.EmailField(required=True)
    phone = forms.CharField(max_length=20, required=True, label="Téléphone portable")

class CouponApplyForm(forms.Form):
    code = forms.CharField(max_length=50)

class ShippingAddressForm(forms.ModelForm):
    class Meta:
        model = ShippingAddress
        fields = ['street_address', 'apartment', 'city', 'postal_code', 'country']
        widgets = {
            'street_address': forms.TextInput(attrs={'placeholder': 'Adresse'}),
            'apartment': forms.TextInput(attrs={'placeholder': 'Appartement (optionnel)'}),
            'city': forms.TextInput(attrs={'placeholder': 'Ville'}),
            'postal_code': forms.TextInput(attrs={'placeholder': 'Code postal'}),
            'country': forms.TextInput(attrs={'placeholder': 'Pays'}),
        }
