import os, json

HONEYFILE_TEMPLATES = {
    "db_credentials.txt": "host=localhost\nuser=admin\npassword=S3cr3tP@ss\ndb=production\n",
    "aws_keys.txt": "[default]\naws_access_key_id=AKIAIOSFODNN7EXAMPLE\naws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\n",
    "id_rsa": "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEA2a2rwplBQLF29amygykEMmYz0+Kcj3bKBp29P2rFj7cFSCOB\n-----END RSA PRIVATE KEY-----\n",
    "shadow.bak": "root:$6$xyz$hashedpasswordhere:19000:0:99999:7:::\nadmin:$6$abc$anotherhash:19000:0:99999:7:::\n",
}

def deploy(files, profile):
    home = os.path.expanduser("~")
    deployed = []

    for fname, content in HONEYFILE_TEMPLATES.items():
        path = os.path.join(home, fname)
        with open(path, 'w') as f:
            f.write(content)
        os.chmod(path, 0o644)
        deployed.append(path)

    # Write baseline
    base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    baseline_path = os.path.join(base, 'logs', 'baseline.json')
    os.makedirs(os.path.dirname(baseline_path), exist_ok=True)
    with open(baseline_path, 'w') as f:
        json.dump({"honeyfiles": deployed}, f, indent=2)

    return deployed
