#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This program is dedicated to the public domain under the CC0 license.

import logging
from pathlib import Path

from telegram.ext import Updater

from biohack_questions.src.constants import FILE_DOWNLOAD_PATH
from biohack_questions.src.handlers import initial, reminder
from biohack_questions.src.handlers import check

TOKEN = ''

# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                    level=logging.INFO)

logger = logging.getLogger(__name__)

GENDER, PHOTO, LOCATION, BIO, PROVIDE_NAME, PROVIDE_DOB, DONE, SELECT_PROGRAM = range(8)


def main():
    # Create the Updater and pass it your bot's token.
    # Make sure to set use_context=True to use the new context based callbacks
    # Post version 12 this will no longer be necessary
    updater = Updater(TOKEN, use_context=True)

    download_path = Path(FILE_DOWNLOAD_PATH)
    if not download_path.exists():
        download_path.mkdir()

    # Get the dispatcher to register handlers
    dp = updater.dispatcher

    dp.add_handler(initial.generate_handler())
    dp.add_handler(check.generate_handler())
    dp.add_handler(reminder.generate_set_handler())
    dp.add_handler(reminder.generate_unset_handler())

    # Start the Bot
    updater.start_polling()

    # Run the bot until you press Ctrl-C or the process receives SIGINT,
    # SIGTERM or SIGABRT. This should be used most of the time, since
    # start_polling() is non-blocking and will stop the bot gracefully.
    updater.idle()


if __name__ == '__main__':
    main()
