from typing import List, Optional
from popoll_backend.model import Payload


class Poll(Payload):
    
    def __init__(self, id: str, name: str):
        self.id = id
        self.name = name

class Polls(Payload):
    
    def __init__(self, poll: Optional[Poll]=None, polls: Optional[List[Poll]]=None):
        self.polls = []
        if poll != None:
            self.polls.append(poll)
        if polls != None:
            for p in polls:
                self.polls.append(p)
    
    def add(self, poll: Poll):
        self.polls.append(poll)
    