79 lines
2.6 KiB
Python
79 lines
2.6 KiB
Python
|
|
"""
|
||
|
|
Tax simulation request/response schemas.
|
||
|
|
"""
|
||
|
|
import enum
|
||
|
|
from typing import List
|
||
|
|
|
||
|
|
from pydantic import BaseModel, Field
|
||
|
|
|
||
|
|
|
||
|
|
class AccountType(str, enum.Enum):
|
||
|
|
IRP = "irp"
|
||
|
|
DC = "dc"
|
||
|
|
|
||
|
|
|
||
|
|
class WithdrawalType(str, enum.Enum):
|
||
|
|
PENSION = "pension"
|
||
|
|
LUMP_SUM = "lump_sum"
|
||
|
|
|
||
|
|
|
||
|
|
class TaxDeductionRequest(BaseModel):
|
||
|
|
annual_income: int = Field(..., gt=0, description="연간 총급여 (원)")
|
||
|
|
contribution: int = Field(..., ge=0, description="연간 납입액 (원)")
|
||
|
|
account_type: AccountType = Field(AccountType.IRP, description="계좌 유형")
|
||
|
|
|
||
|
|
|
||
|
|
class TaxDeductionResponse(BaseModel):
|
||
|
|
annual_income: int
|
||
|
|
contribution: int
|
||
|
|
account_type: str
|
||
|
|
deduction_rate: float = Field(..., description="세액공제율 (%)")
|
||
|
|
irp_limit: int = Field(..., description="연간 공제 한도 (원)")
|
||
|
|
deductible_contribution: int = Field(..., description="공제 대상 납입액 (원)")
|
||
|
|
tax_deduction: float = Field(..., description="세액공제 금액 (원)")
|
||
|
|
|
||
|
|
|
||
|
|
class PensionTaxRequest(BaseModel):
|
||
|
|
withdrawal_amount: int = Field(..., gt=0, description="수령 금액 (원)")
|
||
|
|
withdrawal_type: WithdrawalType = Field(WithdrawalType.PENSION, description="수령 방식")
|
||
|
|
age: int = Field(..., ge=55, le=100, description="수령 시 나이")
|
||
|
|
|
||
|
|
|
||
|
|
class PensionTaxResponse(BaseModel):
|
||
|
|
withdrawal_amount: int
|
||
|
|
withdrawal_type: str
|
||
|
|
age: int
|
||
|
|
pension_tax_rate: float = Field(..., description="연금소득세율 (%)")
|
||
|
|
pension_tax: float = Field(..., description="연금소득세 (원)")
|
||
|
|
lump_sum_tax_rate: float = Field(..., description="기타소득세율 (%)")
|
||
|
|
lump_sum_tax: float = Field(..., description="기타소득세 (원)")
|
||
|
|
tax_saving: float = Field(..., description="연금 수령 시 절세 금액 (원)")
|
||
|
|
|
||
|
|
|
||
|
|
class AccumulationRequest(BaseModel):
|
||
|
|
monthly_contribution: int = Field(..., gt=0, description="월 납입액 (원)")
|
||
|
|
years: int = Field(..., ge=1, le=50, description="적립 기간 (년)")
|
||
|
|
annual_return: float = Field(..., ge=0, le=30, description="연간 기대 수익률 (%)")
|
||
|
|
tax_deduction_rate: float = Field(..., description="세액공제율 (%)")
|
||
|
|
|
||
|
|
|
||
|
|
class YearlyAccumulationData(BaseModel):
|
||
|
|
year: int
|
||
|
|
contribution: int
|
||
|
|
cumulative_contribution: int
|
||
|
|
investment_value: float
|
||
|
|
tax_deduction: float
|
||
|
|
cumulative_tax_deduction: float
|
||
|
|
|
||
|
|
|
||
|
|
class AccumulationResponse(BaseModel):
|
||
|
|
monthly_contribution: int
|
||
|
|
years: int
|
||
|
|
annual_return: float
|
||
|
|
tax_deduction_rate: float
|
||
|
|
total_contribution: int
|
||
|
|
final_value: float
|
||
|
|
total_return: float
|
||
|
|
total_tax_deduction: float
|
||
|
|
yearly_data: List[YearlyAccumulationData]
|