from .hr_length_of_service import length_of_service from .payroll_notice_period_types import StatutoryNotice def statutory_notice(start_date: str, notice_date: str) -> StatutoryNotice: """ERA 1996 s.86 minimum notice. Below one month's service the section does not apply at all, which is different from one week: an employer who dismisses on day 20 owes no statutory notice. """ service = length_of_service(start_date, notice_date) at_least_one_month = service.years > 0 or service.months > 0 employer_weeks = 0 if at_least_one_month: employer_weeks = 1 if service.years < 2 else min(service.years, 12) return StatutoryNotice( service_years=service.years, employer_weeks=employer_weeks, employee_weeks=1 if at_least_one_month else 0, )