import re
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField
from wtforms import SubmitField, TextAreaField, FileField
from flask_wtf.file import FileField, FileAllowed, FileRequired
from wtforms import validators
from wtforms.validators import DataRequired, Length

class Accueil(FlaskForm):
    title = StringField('Titre', validators=[DataRequired()])
    text = TextAreaField('Présentation', validators=[Length(min=0, max=1000)])
    text_button = StringField('Texte du bouton', validators=[])
    link = StringField('Lien', validators=[])
    image = FileField('image', validators=[FileAllowed(['jpg', 'png', 'gif'], 'Images only!')])
    submit = SubmitField('Valider')

class Description(FlaskForm):
    title = StringField('Titre', validators=[DataRequired()])
    text = TextAreaField('Texte', validators=[DataRequired()])
    submit = SubmitField('Valider')

class ImageForm(FlaskForm):
    title = StringField('Titre', validators=[DataRequired()])
    subtitle = StringField('Sous-titre',validators=[])
    category = StringField('Categories',validators=[])
    description = StringField('Description', validators=[])

class ImageUpload(FlaskForm):
    title = StringField('Titre', validators=[DataRequired()])
    subtitle = StringField('Sous-titre',validators=[])
    text = StringField('Une description de votre image', validators=[])
    category = StringField('Categories',validators=[])
    image = FileField('image', validators=[FileRequired(),
                                           FileAllowed(['jpg', 'png', 'gif'], 'Images only!')])
    submit = SubmitField('Valider')

class Lien(FlaskForm):
    title = StringField('Titre', validators=[DataRequired()])
    text = StringField('Texte', validators=[DataRequired()])
    link = StringField('Lien', validators=[DataRequired()])
    text_button = StringField('Texte du bouton', validators=[DataRequired()])
    submit = SubmitField('Valider')

class Contact(FlaskForm):
    title = StringField('Titre', validators=[])
    text = TextAreaField('Texte contact', validators=[])
    email = StringField('Email', validators=[])
    phone = StringField('Téléphone', validators=[])
    address = StringField('Adresse', validators=[])
    postal_code = StringField('Code Postal', validators=[])
    city = StringField('Ville', validators=[])
    submit = SubmitField('Valider')

class Login(FlaskForm):
     passwd = PasswordField('Votre mot de passe', validators=[DataRequired()])
     submit = SubmitField('Se connecter')
