#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Create backup for certain date for specified channel in slack
"""
import argparse
import json

from slack_backup import client


def channel_list(string):
    return string.split(',')

def main():
    """Main function"""
    parser = argparse.ArgumentParser()
    parser.add_argument('-t', '--token', required=True, help='Slack token - '
                        'a string, which can be generated/obtained via '
                        'https://api.slack.com/docs/oauth-test-tokens page')
    parser.add_argument('-d', '--database', default='',
                        help='Path to the database file')
    parser.add_argument('-f', '--format', default='text',
                        choices=('text', 'json', 'html', 'none'),
                        help='Output format. Default is none; only database '
                        'is updated by latest messages for all/selected '
                        'channels.')
    parser.add_argument('-c', '--channels', default=[], nargs='+',
                        help='List of channels to perform actions on. '
                        'Default is all channels')
    parser.add_argument('-t', '--team', default='', help='team name, which is'
                        ' part of slack url, for example: if url is '
                        '"https://team.slack.com" than "team" is a name of '
                        'the team.')
    args = parser.parse_args()

    slack = client.Client(args)
    slack.update()
    # slack.generate_history(Reporter(args.format))


if __name__ == "__main__":
    main()
