"""
Quick Start Guide for Irene Cipher

This script demonstrates the most common use cases.
"""

import irene_cipher


def main():
    print("Irene Cipher - Quick Start\n")
    
    # 1. Simple text encryption
    print("1. Text Encryption:")
    password = "my_password_123"
    secret_message = "This is a confidential message."
    
    encrypted = irene_cipher.encrypt_text(secret_message, password)
    decrypted = irene_cipher.decrypt_text(encrypted, password)
    
    print(f"   Original: {secret_message}")
    print(f"   Encrypted: {encrypted[:40].hex()}...")
    print(f"   Decrypted: {decrypted}")
    print(f"   ✓ Match: {decrypted == secret_message}\n")
    
    # 2. File encryption
    print("2. File Encryption:")
    
    # Create a sample file
    with open("sample.txt", "w") as f:
        f.write("Sample file content\n" * 100)
    
    # Encrypt it
    irene_cipher.encrypt_file("sample.txt", "sample.txt.enc", password)
    print(f"   ✓ Encrypted: sample.txt -> sample.txt.enc")
    
    # Decrypt it
    irene_cipher.decrypt_file("sample.txt.enc", "sample_restored.txt", password)
    print(f"   ✓ Decrypted: sample.txt.enc -> sample_restored.txt")
    
    # Verify
    with open("sample.txt", "r") as f1, open("sample_restored.txt", "r") as f2:
        assert f1.read() == f2.read()
    print(f"   ✓ Files match!\n")
    
    # Cleanup
    import os
    os.remove("sample.txt")
    os.remove("sample.txt.enc")
    os.remove("sample_restored.txt")
    
    # 3. Generate random key
    print("3. Key Generation:")
    key = irene_cipher.generate_key()
    print(f"   Random key: {key.hex()}")
    print(f"   Key length: {len(key)} bytes\n")
    
    print("✓ Quick start complete!")


if __name__ == "__main__":
    main()
