Endogenous labor supply, borrowing constraint, and credit cycles