""" 급여 추정 (옵션). 포괄임금제 회사면 사용 안 함. 시급 + 연장수당 가산률만 받아서 단순 계산. """ from __future__ import annotations from typing import List, Dict def estimate_pay(records: List[Dict], hourly_wage: float, overtime_rate: float = 1.5) -> Dict[str, float]: """근무 기록 리스트로부터 추정 급여 계산. Args: records: [{'total_hours': float, 'overtime_minutes': int}, ...] hourly_wage: 시급(원) overtime_rate: 연장수당 가산률 (기본 1.5배 - 한국 노동법) Returns: {'base': 기본급, 'overtime': 연장수당, 'total': 합계} """ if hourly_wage <= 0: return {'base': 0.0, 'overtime': 0.0, 'total': 0.0} base_hours = 0.0 overtime_hours = 0.0 for r in records: total = float(r.get('total_hours') or 0) ot_min = int(r.get('overtime_minutes') or 0) ot_hours = ot_min / 60.0 # 정규 근무 = 총 - 연장 regular = max(0.0, total - ot_hours) base_hours += regular overtime_hours += ot_hours base = base_hours * hourly_wage overtime = overtime_hours * hourly_wage * overtime_rate return { 'base': base, 'overtime': overtime, 'total': base + overtime, 'base_hours': base_hours, 'overtime_hours': overtime_hours, } def format_won(amount: float) -> str: """원화 포맷팅. 1234567 → '1,234,567원'.""" return f"{int(round(amount)):,}원"