NAME
    planta-filler - Automatic timesheet filling for PLANTA

SYNOPSIS
    python planta_filler.py [OPTIONS]

DESCRIPTION
    Automates filling timesheets in PLANTA by distributing working hours
    across tasks according to configurable strategies. Reads target hours
    from the 'Anwesend' column and fills input fields automatically.

OPTIONS
    --url URL
        PLANTA URL to access
        Default: {default_url}

    --strategy STRATEGY
        Hour distribution strategy. One of:
          random       - Random distribution with variance
          equal        - Equal distribution across all tasks
          copy_reference - Copy pattern from reference day
        Default: {default_strategy}

    --weekdays WEEKDAYS
        Comma-separated list of weekdays to process
        Format: 0,1,2,3,4
        Weekday codes:
          0 = Monday
          1 = Tuesday
          2 = Wednesday
          3 = Thursday
          4 = Friday
          5 = Saturday
          6 = Sunday
        Default: {default_weekdays} (Monday-Friday)

    --week WEEK
        Week(s) to process. Format: YYYY-WNN or relative offset (comma-separated)
        Examples: 2024-W05, -1 (last week), 0 (current week), 0,-1 (current then last)
        Preserves the order you provide and navigates between weeks accordingly.
        Default: current week

    --reset
        Reset hours to 0 instead of filling. Applies only to the specified week(s) and respects --exclude.
        Default: false (fill mode)

    --persistent
        Use persistent Firefox profile to save login between sessions
        Profile location: ~/.selenium_profiles/planta_firefox/
        Default: {default_persistent}

    --headless
        Run browser in headless mode (no visible window)
        Default: {default_headless}

    --delay SECONDS
        Delay between field updates in seconds
        Default: {default_delay}

    --exclude INDICES
        Comma-separated zero-based row indices to exclude from filling/resets
        Example: --exclude 0,2,4

    --reference-file PATH
        Full path to a reference CSV (single-day or whole-week). Used with copy_reference.
        If missing/malformed/mismatched, falls back to equal for the day and logs the reason.

    --close-delay SECONDS
        Delay before closing browser (time to verify changes)
        Default: {default_close_delay}

    --help, -h
        Show help message and exit

    --man
        Show this manual page

EXAMPLES
    Basic usage with defaults (fill Mon-Fri with equal strategy):
        python3 planta_filler.py

    Fill with random noise distribution:
        python3 planta_filler.py --strategy random_noise

    Fill only Monday, Wednesday, Friday:
        python3 planta_filler.py --weekdays 0,2,4

    Reset current week to zero:
        python3 planta_filler.py --reset

    Fill last week:
        python3 planta_filler.py --week -1

    Use persistent profile (saves login):
        python3 planta_filler.py --persistent

    Run in headless mode:
        python3 planta_filler.py --headless

STRATEGIES
    random
        Distributes hours randomly with ~40% variance around equal
        distribution. Creates realistic-looking timesheets.
        Example: 8h across 4 tasks -> [1.5h, 2.3h, 2.1h, 2.1h]

    equal
        Distributes hours equally across all tasks.
        Example: 8h across 4 tasks -> [2.0h, 2.0h, 2.0h, 2.0h]

    copy_reference
        Copies the percentage distribution from a reference day.
        Useful for maintaining consistent patterns.
        Example: Reference [2h, 4h, 2h] (25%, 50%, 25%)
                 New 10h -> [2.5h, 5.0h, 2.5h]
                 
PERSISTENT PROFILE
    Using --persistent saves cookies and login sessions in:
        ~/.selenium_profiles/planta_firefox/
    
    First run: Login manually
    Subsequent runs: Automatically logged in

FILES
    ~/.selenium_profiles/planta_firefox/
        Firefox profile directory (when using --persistent)

    config.py
        Default configuration values

    planta_selectors.yaml
        CSS selectors for PLANTA DOM elements

    default_reference.csv
        Reference hour distributions for copy_reference strategy

REQUIREMENTS
    - Python 3.7+
    - selenium
    - pyyaml
    - Firefox browser
    - geckodriver (Firefox WebDriver)

EXIT STATUS
    0   Success
    1   Error occurred

TROUBLESHOOTING
    "selenium.common.exceptions.WebDriverException"
        Install geckodriver: https://github.com/mozilla/geckodriver/releases

    Fields not updating:
        Increase --delay value (e.g., --delay 0.3)

    Login not saved:
        Use --persistent flag

COPYRIGHT
    MIT License
