import numpy as np
import pandas as pd

import passwords

config_dict_notifications = {
    "email_to_notify": passwords.email_to_notify,
    "mailgun_default_smtp_login": passwords.mailgun_default_smtp_login,
    "mailgun_api_base_url": passwords.mailgun_api_base_url,
    "mailgun_api_key": passwords.mailgun_api_key
}

config_dict_twitter_details = {
    "twitter_user_details": {
        "contributors_enabled": None,
        "created_at": "DATETIME",
        "default_profile": None,
        "default_profile_image": None,
        "description": None,
        "entities_description_urls": None,
        "entities_url_urls": None,
        "favourites_count": None,
        "follow_request_sent": None,
        "followers_count": "INT",
        "following": None,
        "friends_count": None,
        "geo_enabled": None,
        "has_extended_profile": None,
        "id": "BIGINT PRIMARY KEY",
        "id_str": None,
        "is_translation_enabled": None,
        "is_translator": None,
        "lang": None,
        "listed_count": None,
        "location": None,
        "name": None,
        "needs_phone_verification": None,
        "notifications": None,
        "profile_background_color": None,
        "profile_background_image_url": None,
        "profile_background_image_url_https": None,
        "profile_background_tile": None,
        "profile_banner_url": None,
        "profile_image_url": None,
        "profile_image_url_https": None,
        "profile_link_color": None,
        "profile_sidebar_border_color": None,
        "profile_sidebar_fill_color": None,
        "profile_text_color": None,
        "profile_use_background_image": None,
        "protected": None,
        "screen_name": None,
        "status_contributors": None,
        "status_coordinates": None,
        "status_coordinates_coordinates": None,
        "status_coordinates_type": None,
        "status_created_at": None,
        "status_entities_hashtags": None,
        "status_entities_media": None,
        "status_entities_symbols": None,
        "status_entities_urls": None,
        "status_entities_user_mentions": None,
        "status_extended_entities_media": None,
        "status_favorite_count": None,
        "status_favorited": None,
        "status_geo": None,
        "status_geo_coordinates": None,
        "status_geo_type": None,
        "status_id": None,
        "status_id_str": None,
        "status_in_reply_to_screen_name": None,
        "status_in_reply_to_status_id": None,
        "status_in_reply_to_status_id_str": None,
        "status_in_reply_to_user_id": None,
        "status_in_reply_to_user_id_str": None,
        "status_is_quote_status": None,
        "status_lang": "VARCHAR(20)",
        "status_place": None,
        "status_place_bounding_box_coordinates": None,
        "status_place_bounding_box_type": None,
        "status_place_contained_within": None,
        "status_place_country": None,
        "status_place_country_code": None,
        "status_place_full_name": None,
        "status_place_id": None,
        "status_place_name": None,
        "status_place_place_type": None,
        "status_place_url": None,
        "status_possibly_sensitive": None,
        "status_quoted_status_id": None,
        "status_quoted_status_id_str": None,
        "status_retweet_count": None,
        "status_retweeted": None,
        "status_retweeted_status_contributors": None,
        "status_retweeted_status_coordinates": None,
        "status_retweeted_status_created_at": None,
        "status_retweeted_status_entities_hashtags": None,
        "status_retweeted_status_entities_media": None,
        "status_retweeted_status_entities_symbols": None,
        "status_retweeted_status_entities_urls": None,
        "status_retweeted_status_entities_user_mentions": None,
        "status_retweeted_status_extended_entities_media": None,
        "status_retweeted_status_favorite_count": None,
        "status_retweeted_status_favorited": None,
        "status_retweeted_status_geo": None,
        "status_retweeted_status_id": None,
        "status_retweeted_status_id_str": None,
        "status_retweeted_status_in_reply_to_screen_name": None,
        "status_retweeted_status_in_reply_to_status_id": None,
        "status_retweeted_status_in_reply_to_status_id_str": None,
        "status_retweeted_status_in_reply_to_user_id": None,
        "status_retweeted_status_in_reply_to_user_id_str": None,
        "status_retweeted_status_is_quote_status": None,
        "status_retweeted_status_lang": None,
        "status_retweeted_status_place": None,
        "status_retweeted_status_possibly_sensitive": None,
        "status_retweeted_status_quoted_status_id": None,
        "status_retweeted_status_quoted_status_id_str": None,
        "status_retweeted_status_retweet_count": None,
        "status_retweeted_status_retweeted": None,
        "status_retweeted_status_source": None,
        "status_retweeted_status_full_text": None,
        "status_retweeted_status_truncated": None,
        "status_source": None,
        "status_full_text": None,
        "status_truncated": None,
        "statuses_count": "BIGINT",
        "suspended": None,
        "time_zone": None,
        "translator_type": None,
        "url": None,
        "verified": None,
        "utc_offset": None
    }
}

config_dict_sqlite = {
    "sql": {
        "dbtype": "sqlite",
        "host": None,
        "user": None,
        "passwd": None,
        "dbname": "test_db"
    },
    "twitter_user_details": config_dict_twitter_details["twitter_user_details"],
    "notifications": config_dict_notifications
}

config_dict_mysql = {
    "sql": {
        "dbtype": "mysql",
        "host": "127.0.0.1",
        "user": "sparsetwitter",
        "passwd": passwords.sparsetwittermysqlpw,
        "dbname": "sparsetwitter"
    },
    "twitter_user_details": config_dict_twitter_details["twitter_user_details"],
    "notifications": config_dict_notifications
}

# TODO: FELDER OHNE VORKOMMEN RAUS?
config_dict_user_details_dtypes_sqlite = {
    "sql": {
        "dbtype": "sqlite",
        "host": None,
        "user": None,
        "passwd": None,
        "dbname": "test_db"
    },
    "twitter_user_details": {
        "contributors_enabled": "SMALLINT",
        "created_at": "DATETIME",
        "default_profile": "SMALLINT",
        "default_profile_image": "SMALLINT",
        "description": "TEXT",
        "entities_description_urls": "TEXT",
        "entities_url_urls": "TEXT",
        "favourites_count": "BIGINT",
        "follow_request_sent": "SMALLINT",
        "followers_count": "BIGINT",
        "following": "SMALLINT",
        "friends_count": "BIGINT",
        "geo_enabled": "SMALLINT",
        "has_extended_profile": "SMALLINT",
        "id": "BIGINT PRIMARY KEY",
        "id_str": "VARCHAR(30)",
        "is_translation_enabled": "SMALLINT",
        "is_translator": "SMALLINT",
        "lang": "VARCHAR(30)",
        "listed_count": "BIGINT",
        "location": "TEXT",
        "name": "VARCHAR(50)",
        "needs_phone_verification": "SMALLINT",
        "notifications": "SMALLINT",
        "profile_background_color": "CHAR(6)",
        "profile_background_image_url": "TEXT",
        "profile_background_image_url_https": "TEXT",
        "profile_background_tile": "SMALLINT",
        "profile_banner_url": "TEXT",
        "profile_image_url": "TEXT",
        "profile_image_url_https": "TEXT",
        "profile_link_color": "CHAR(6)",
        "profile_sidebar_border_color": "CHAR(6)",
        "profile_sidebar_fill_color": "CHAR(6)",
        "profile_text_color": "CHAR(6)",
        "profile_use_background_image": "SMALLINT",
        "protected": "SMALLINT",
        "screen_name": "VARCHAR(50)",
        "status_contributors": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_coordinates": "TEXT",
        "status_coordinates_coordinates": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_coordinates_type": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_created_at": "DATETIME",
        "status_entities_hashtags": "TEXT",
        "status_entities_media": "TEXT",
        "status_entities_symbols": "TEXT",
        "status_entities_urls": "TEXT",
        "status_entities_user_mentions": "TEXT",
        "status_extended_entities_media": "TEXT",
        "status_favorite_count": "INT",
        "status_favorited": "SMALLINT",
        "status_geo": "TEXT",
        "status_geo_coordinates": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_geo_type": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_id": "BIGINT",
        "status_id_str": "VARCHAR(50)",
        "status_in_reply_to_screen_name": "VARCHAR(30)",
        "status_in_reply_to_status_id": "BIGINT",
        "status_in_reply_to_status_id_str": "VARCHAR(50)",
        "status_in_reply_to_user_id": "BIGINT",
        "status_in_reply_to_user_id_str": "VARCHAR(30)",
        "status_is_quote_status": "SMALLINT",
        "status_lang": "VARCHAR(30)",
        "status_place": "TEXT",
        "status_place_bounding_box_coordinates": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_place_bounding_box_type": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_place_contained_within": "TEXT",   # TODO: SEE IF THIS IS NEEDED
        "status_place_country": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_place_country_code": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_place_full_name": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_place_id": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_place_name": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_place_place_type": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_place_url": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_possibly_sensitive": "SMALLINT",
        "status_quoted_status_id": "BIGINT",
        "status_quoted_status_id_str": "VARCHAR(50)",
        "status_retweet_count": "INT",
        "status_retweeted": "SMALLINT",
        "status_retweeted_status_contributors": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_retweeted_status_coordinates": "TEXT",
        "status_retweeted_status_created_at": "DATETIME",
        "status_retweeted_status_entities_hashtags": "TEXT",
        "status_retweeted_status_entities_media": "TEXT",
        "status_retweeted_status_entities_symbols": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "status_retweeted_status_entities_urls": "TEXT",
        "status_retweeted_status_entities_user_mentions": "TEXT",
        "status_retweeted_status_extended_entities_media": "TEXT",
        "status_retweeted_status_favorite_count": "INT",
        "status_retweeted_status_favorited": "SMALLINT",
        "status_retweeted_status_geo": "TEXT",
        "status_retweeted_status_id": "BIGINT",
        "status_retweeted_status_id_str": "VARCHAR(50)",
        "status_retweeted_status_in_reply_to_screen_name": "VARCHAR(30)",
        "status_retweeted_status_in_reply_to_status_id": "BIGINT",
        "status_retweeted_status_in_reply_to_status_id_str": "VARCHAR(50)",
        "status_retweeted_status_in_reply_to_user_id": "BIGINT",
        "status_retweeted_status_in_reply_to_user_id_str": "VARCHAR(30)",
        "status_retweeted_status_is_quote_status": "SMALLINT",
        "status_retweeted_status_lang": "VARCHAR(30)",
        "status_retweeted_status_place": "TEXT",
        "status_retweeted_status_possibly_sensitive": "SMALLINT",
        "status_retweeted_status_quoted_status_id": "BIGINT",
        "status_retweeted_status_quoted_status_id_str": "VARCHAR(50)",
        "status_retweeted_status_retweet_count": "INT",
        "status_retweeted_status_retweeted": "SMALLINT",
        "status_retweeted_status_source": "TEXT",
        "status_retweeted_status_full_text": "TEXT",
        "status_retweeted_status_truncated": "SMALLINT",
        "status_source": "TEXT",
        "status_full_text": "TEXT",
        "status_truncated": "SMALLINT",
        "statuses_count": "BIGINT",
        "suspended": "SMALLINT",
        "time_zone": "TEXT",  # TODO: SEE IF THIS IS NEEDED
        "translator_type": "VARCHAR(30)",
        "url": "TEXT",
        "verified": "SMALLINT",
        "utc_offset": "TEXT"   # TODO: SEE IF THIS IS NEEDED
    },
    "notifications": config_dict_notifications
}

config_dict_user_details_dtypes_mysql = {
    "sql": {
        "dbtype": "mysql",
        "host": "127.0.0.1",
        "user": "sparsetwitter",
        "passwd": passwords.sparsetwittermysqlpw,
        "dbname": "sparsetwitter"
    },
    "twitter_user_details": config_dict_user_details_dtypes_sqlite["twitter_user_details"],
    "notifications": config_dict_notifications
}

friends_details_pddf_dtypes = {
    "contributors_enabled": bool,
    "created_at": pd.Timestamp,
    "default_profile": bool,
    "default_profile_image": bool,
    "description": str,
    "entities_description_urls": str,
    "entities_url_urls": str,
    "favourites_count": np.int64,
    "follow_request_sent": bool,
    "followers_count": np.int64,
    "following": bool,
    "friends_count": np.int64,
    "geo_enabled": bool,
    "has_extended_profile": bool,
    "id": np.int64,
    "id_str": str,
    "is_translation_enabled": bool,
    "is_translator": bool,
    "lang": str,
    "listed_count": np.int64,
    "location": str,
    "name": str,
    "needs_phone_verification": bool,
    "notifications": bool,
    "profile_background_color": str,
    "profile_background_image_url": str,
    "profile_background_image_url_https": str,
    "profile_background_tile": bool,
    "profile_banner_url": str,
    "profile_image_url": str,
    "profile_image_url_https": str,
    "profile_link_color": str,
    "profile_sidebar_border_color": str,
    "profile_sidebar_fill_color": str,
    "profile_text_color": str,
    "profile_use_background_image": bool,
    "protected": bool,
    "screen_name": str,
    "status_contributors": str,
    "status_coordinates": str,
    "status_coordinates_coordinates": str,
    "status_coordinates_type": str,
    "status_created_at": pd.Timestamp,
    "status_entities_hashtags": str,
    "status_entities_media": str,
    "status_entities_symbols": str,
    "status_entities_urls": str,
    "status_entities_user_mentions": str,
    "status_extended_entities_media": str,
    "status_favorite_count": np.int64,
    "status_favorited": bool,
    "status_geo": str,
    "status_geo_coordinates": str,
    "status_geo_type": str,
    "status_id": np.int64,
    "status_id_str": str,
    "status_in_reply_to_screen_name": str,
    "status_in_reply_to_status_id": np.int64,
    "status_in_reply_to_status_id_str": str,
    "status_in_reply_to_user_id": np.int64,
    "status_in_reply_to_user_id_str": str,
    "status_is_quote_status": bool,
    "status_lang": str,
    "status_place": str,
    "status_place_bounding_box_coordinates": str,
    "status_place_bounding_box_type": str,
    "status_place_contained_within": str,
    "status_place_country": str,
    "status_place_country_code": str,
    "status_place_full_name": str,
    "status_place_id": str,
    "status_place_name": str,
    "status_place_place_type": str,
    "status_place_url": str,
    "status_possibly_sensitive": bool,
    "status_quoted_status_id": np.int64,
    "status_quoted_status_id_str": str,
    "status_retweet_count": np.int64,
    "status_retweeted": bool,
    "status_retweeted_status_contributors": str,
    "status_retweeted_status_coordinates": str,
    "status_retweeted_status_created_at": pd.Timestamp,
    "status_retweeted_status_entities_hashtags": str,
    "status_retweeted_status_entities_media": str,
    "status_retweeted_status_entities_symbols": str,
    "status_retweeted_status_entities_urls": str,
    "status_retweeted_status_entities_user_mentions": str,
    "status_retweeted_status_extended_entities_media": str,
    "status_retweeted_status_favorite_count": np.int64,
    "status_retweeted_status_favorited": bool,
    "status_retweeted_status_geo": str,
    "status_retweeted_status_id": np.int64,
    "status_retweeted_status_id_str": str,
    "status_retweeted_status_in_reply_to_screen_name": str,
    "status_retweeted_status_in_reply_to_status_id": np.int64,
    "status_retweeted_status_in_reply_to_status_id_str": str,
    "status_retweeted_status_in_reply_to_user_id": np.int64,
    "status_retweeted_status_in_reply_to_user_id_str": str,
    "status_retweeted_status_is_quote_status": bool,
    "status_retweeted_status_lang": str,
    "status_retweeted_status_place": str,
    "status_retweeted_status_possibly_sensitive": bool,
    "status_retweeted_status_quoted_status_id": np.int64,
    "status_retweeted_status_quoted_status_id_str": str,
    "status_retweeted_status_retweet_count": np.int64,
    "status_retweeted_status_retweeted": bool,
    "status_retweeted_status_source": str,
    "status_retweeted_status_full_text": str,
    "status_retweeted_status_truncated": bool,
    "status_source": str,
    "status_full_text": str,
    "status_truncated": bool,
    "statuses_count": np.int64,
    "suspended": bool,
    "time_zone": str,
    "translator_type": str,
    "url": str,
    "verified": bool,
    "utc_offset": str
}
