# First run

```bash
python -m venv .venv
# Windows:
.venv\Scripts\activate
# Linux/macOS:
# source .venv/bin/activate

pip install -r requirements.txt

python manage.py makemigrations admin_panel
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
```

Use the API under `http://127.0.0.1:8000/api/admin-panel/`.

## Authentication

1. Create an Admin user (or use the superuser; set `role=ADMIN` for API use).
2. POST username/password to `/auth/login/`.
3. Send `Authorization: Bearer <access-token>` to Admin endpoints.

Example login JSON:

```json
{
  "username": "admin",
  "password": "StrongPassword123!"
}
```

## Example: create Silver scheme

```json
{
  "category": "SILVER",
  "name": "Silver Monthly Withdrawal",
  "description": "Simple-interest scheme",
  "tenure_months": 12,
  "annual_interest_rate": "12.0000",
  "penalty_rate": "2.0000",
  "withdrawal_type": "MONTHLY_WITHDRAWAL",
  "rules": [
    "Interest rate is per annum.",
    "Simple interest applies."
  ],
  "is_active": true
}
```

## Example: create Platinum scheme

```json
{
  "category": "PLATINUM",
  "name": "Platinum RD 500",
  "tenure_months": 12,
  "annual_interest_rate": "10.0000",
  "penalty_rate": "3.0000",
  "monthly_installment": "500.00",
  "rules": [
    "Monthly recurring contribution.",
    "RD formula supplied by client is used for maturity calculation."
  ],
  "is_active": true
}
```

For ₹500/month, 12 months, 10% p.a., the maturity calculator returns ₹6,325.

## Example: Kuber investment

```json
{
  "business": 1,
  "amount": "100000.00",
  "annual_rate": "20.0000",
  "investment_date": "2026-09-15",
  "notes": "Kuber-side investment into ABC"
}
```

## Example: investor investment

```json
{
  "investor": 1,
  "business": 1,
  "scheme": 1,
  "amount": "100000.00",
  "investor_annual_rate": "12.0000"
}
```

Then `/ledger/generate-daily/` can create the business-side credit and Silver investor-side soft debit.

## Security

The supplied requirements mention that passwords are shown in Admin. This implementation intentionally does not store or expose plaintext passwords. Django hashes passwords. If the business requires a credential display screen, use a one-time credential issuance/download or secure reset flow rather than storing plaintext credentials.
