from webapp.models import Signup, SignupForm
from django.utils import timezone
from webapp.utils import month_from_now

import json

ALL_QUESTION_TYPES = [
    {"id": "j5CeRZDvl", "name": "Asd", "type": "text", "options": []},
    {"id": "RHJhSoaLD", "name": "Asd2", "type": "radiobutton", "options": ["Yes", "no", "maybe"]},
    {"id": "i10d426d5", "name": "Asd3", "type": "checkbox", "options": ["A", "B", "C"]}
]

ALL_QUESTION_TYPES_ANSWER = {"j5CeRZDvl": "Testi", "RHJhSoaLD": "maybe", "i10d426d5": ["B", "C"]}


def createSignupForm(name="Form1", start_time=timezone.now(), end_time=month_from_now(), questions=ALL_QUESTION_TYPES, visible=True):
    return SignupForm.objects.create(
        title=name,
        start_time=start_time,
        end_time=end_time,
        questions=questions,
        visible=visible
    )


def createSignupObject(list_name, form, answer):
    return Signup.objects.create(
        list_name=list_name,
        signupForm=form,
        answer=answer
    )


def createSignupRequest(list_name, form_id, answer):
    return {
        "list_name": list_name,
        "signupForm_id": form_id,
        "answer": answer
    }
