from multiprocessing.context import SpawnContext
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileRequired, FileAllowed
from wtforms import StringField, TextAreaField, SelectField, MultipleFileField
from wtforms.validators import DataRequired


class CollectionCreateForm(FlaskForm):
    title = StringField('標題', validators=[DataRequired()])
    image = FileField('圖片', validators=[FileRequired(), FileAllowed(['jpg', 'png', 'gif', 'webp'], 'Images only!')])
    collectiontitle = StringField('作品集標題', validators=[DataRequired()])
    description = TextAreaField('描述', validators=[DataRequired()])
    tags = StringField('分類')
    coverimg = FileField('封面圖片', validators=[FileRequired(), FileAllowed(['jpg', 'png', 'gif', 'webp'], 'Images only!')])
    bannerimgtext = StringField('封面圖片說明', validators=[DataRequired()])
    homeowner = StringField('屋主', validators=[DataRequired()])
    ownerimg = FileField('屋主照片', validators=[FileAllowed(['jpg', 'png', 'gif', 'webp'], 'Images only!')])
    size = SelectField('坪數範圍', choices=['20坪以下', '20-35坪', '36-50坪', '51坪以上'],validators=[DataRequired()])
    housesize = StringField('坪數', validators=[DataRequired()])
    bednum = SelectField('格局', choices=['一房', '二房', '三房', '四房', '四房以上'],validators=[DataRequired()])
    roomcount = StringField('幾房幾廳?', validators=[DataRequired()])
    housetype = SelectField('屋型', choices=['大樓', '透天'], validators=[DataRequired()])
    designer = StringField('設計師', validators=[DataRequired()])
    space = TextAreaField('設計空間', validators=[DataRequired()])
    loc = SelectField('地區', choices=['台北','新北','基隆','桃園','新竹','苗栗','台中','南投','彰化','雲林','嘉義','台南','高雄','屏東','宜蘭','花蓮','台東','澎湖','金門','馬祖','其他'], validators=[DataRequired()])
    budgetr = SelectField('預算', choices=['59萬以下', '60-79萬', '80-99萬', '100萬以上'],validators=[DataRequired()])
    budget = StringField('總預算', validators=[DataRequired()])
    construction = StringField('建案名稱', validators=[DataRequired()])
    collectiondesc = TextAreaField('作品集描述', validators=[DataRequired()])
    # collectionslider = MultipleFileField('作品集圖片集', validators=[FileRequired(), FileAllowed(['jpg', 'png', 'gif', 'webp'], 'Images only!')])
    comment = FileField('Comment', validators=[FileAllowed(['jpg', 'png', 'gif', 'webp'], 'Images only!')])


'''
form.title.data,'',form.title.data,form.collectiontitle.data,
              get_now_time(),
              'true',
              'collection',
              '/collection/{}'.format(eng_name),
              form.image.data.filename, form.coverimg.data.filename,
              form.description.data.replace('\r\n','<br>'),
              form.tags.data, form.bannerimgtext.data, form.homeowner.data,
              form.size.data, form.bednum.data, form.housetype.data,
              form.designer.data, form.space.data, form.loc.data,
              form.budget.data, form.construction.data, form.collectiondesc.data
'''