# Account information
#
# Add information about each of your accounts to the accounts dictionary.
#
# You can use the dedent function to strip leading whitespace from
# multi-line remarks.  You can use the character sets and exclude function
# to create alphabets for you character-base passwords.
#
# Example:
# To create an alphabet with all characters except tabs use either:
#     'alphabet': exclude(PRINTABLE, '\t')
# or:
#     'alphabet': ALPHANUMERIC + PUNCTUATION + ' '

from avendesora import (
    # Basics
    Account, Hidden, GPG, Script,

    # Character sets
    exclude, LOWERCASE, UPPERCASE, LETTERS, DIGITS, ALPHANUMERIC,
    HEXDIGITS, PUNCTUATION, WHITESPACE, PRINTABLE, DISTINGUISHABLE,

    # Secrets
    Password, Passphrase, PIN, Question, MixedPassword, BirthDate, OTP,

    # Account Discovery
    RecognizeAll, RecognizeAny, RecognizeTitle, RecognizeURL, RecognizeCWD,
    RecognizeHost, RecognizeUser, RecognizeEnvVar,
)

master_seed = Hidden(
    'c2VjcmV0IG1lc3NhZ2UsIHN1Y2Nlc3NmdWxseSBkZWNvZGVkIQ==',
    secure=False
)
ken = Hidden(
    'c2VjcmV0IG1lc3NhZ2UsIHN1Y2Nlc3NmdWxseSBkZWNvZGVkIQ==',
    secure=False
)

# Switch to using OrderedDict on older versions of Python to avoid 
# nondeterminate order in dictionaries, which causes tests to fail.
import sys
if sys.version_info < (3,6,0):
    from collections import OrderedDict
    dict = OrderedDict

# Accounts
# AlertSCC {{{1
class AlertSCC(Account):
    aliases = ['scc']
    email = 'pizzaman@pizza.com'
    comments = '''
        Account where I signed up for local alert messages from the county 
        government.
    '''
    master = ken
    default  = 'email is {email}, password is {password}'
    password = Password()
    account = Hidden('MTIzNDU2LTc4OTA=')
    birthdate = BirthDate(2016, 25, 55)
    questions = [
        Question('What city were you born in?'),
        Question('What street did you grow up on?'),
        Question('What was your childhood nickname?'),
    ]
    discovery = [
        RecognizeAll(
            RecognizeURL(
                'https://alertscc.bbcportal.com/Validation',
                name='validation',
            ),
            RecognizeUser('ken'),
            script='{birthdate}{return}',
        ),
        RecognizeAll(
            RecognizeURL(
                'https://alertscc.bbcportal.com',
                name='login',
            ),
            RecognizeUser('ken'),
            script='{email}{tab}{password}{return}',
        ),
    ]

# Login {{{1
class Login(Account):
    aliases = ['luks']
    passcode = Passphrase(length=6)
    discovery = [
        RecognizeAll(
            RecognizeHost('pizzaville'),
            RecognizeTitle(
                # these are used in the terminal
                'sudo', 'sudo *',

                # this is used in for virt-manager
                'Authentication',

                # this is used in for xxx (my logout script)
                '/bin/csh -f /home/ken/bin/xxx'
            ),
            script='{passcode}{return}'
        ),
    ]

# MyBank {{{1
class MyBank(Account):
    aliases = ['mb']
    username = 'pizzaman'
    email = 'pizzaman@pizza.com'
    urls = 'https://mb.com'
    passcode = MixedPassword(
        12, ALPHANUMERIC,
        [(LOWERCASE, 2), (UPPERCASE, 2), (DIGITS, 2), ('@#$%&*+=', 2)]
    )
    verbal = Passphrase(length=2)
    pin = PIN()
    birthdate = BirthDate(2018, is_secret=False)
    questions = [
        Question('What city were you born in?'),
        Question('What street did you grow up on?'),
        Question('What was your childhood nickname?'),
    ]
    accounts = dict([
        ('checking',   Hidden('MTIzNDU2Nzg=')),
        ('savings',    Hidden('MjM0NTY3ODk=')),
        ('creditcard', Hidden('MzQ1Njc4OTA=')),
    ])
    checking=Script('{accounts.checking}')
    customer_service = '1-866-229-6633'
    #otp = OTP('JBSWY3DPEHPK3PXP')
    discovery = RecognizeTitle(
        'easy peasy',
        script='lemon squeezy'
    )
    comment = '''
        This is a multiline comment.
        It spans more than one line.
    '''

# Margaritaville {{{1
class Margaritaville(Account):
    email = 'pizzaman@pizza.com'
    urls = 'https://www.margaritaville.com'
    passcode = Password()

# Include a few unicode characters, but to make sure they work: ±αβγδε
# vim: filetype=python sw=4 sts=4 et ai ff=unix :
