Metadata-Version: 2.4
Name: talent-gate-base
Version: 0.3.13
Summary: Shared subscription, payment, and multi-tenancy models for TalentGate ecosystem
Author: AFEX Innovation Lab, Abdulbasit Damilola Alabi
License: Proprietary
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: Django>=4.2
Requires-Dist: requests>=2.28
Requires-Dist: python-dateutil>=2.8
Provides-Extra: celery
Requires-Dist: celery>=5.3; extra == "celery"

# TalentGate Base

The core shared package for the TalentGate multi-tenant SaaS ecosystem. This package provides abstract models, services, and security utilities to maintain consistency across all TalentGate-integrated applications (like HRMS, BMS, etc.).

## Features

- **Multi-Tenancy**: Base abstract models for Organizations and Subscriptions.
- **Payment Integration**: Standardized wrappers for Paystack and Bank Transfer workflows.
- **Inter-System Communication**: Secure HMAC-based communication utilities for service-to-service calls.
- **Feature Gating**: Middleware to enforce subscription status across your application.

## Installation

Install via pip:

```bash
pip install talent-gate-base
```

## Setup & Configuration

### 1. Add to Django Settings

Add the package to your `INSTALLED_APPS` and specify your organization model:

```python
INSTALLED_APPS = [
    ...
    "talent_gate_base",
]

# Required for the multi-tenant models
ORGANIZATION_MODEL = "your_app.Organization"
```

### 2. Implement Concrete Models

This package provides **Abstract** models. You must inherit from them in your local app:

```python
from talent_gate_base.models.organization import AbstractOrganization
from talent_gate_base.models.subscription import AbstractSubscription

class Organization(AbstractOrganization):
    # Add your system-specific organization fields here
    pass

class Subscription(AbstractSubscription):
    # Add your system-specific subscription logic here
    pass
```

### 3. Inter-System Security

To communicate securely between TalentGate and your app, use the `SystemCommunicator`:

```python
from talent_gate_base.services.system_comm import SystemCommunicator

# Verifying an incoming request from TalentGate
is_valid, error = SystemCommunicator.verify_django_request(
    request, 
    expected_api_key=settings.TG_API_KEY,
    expected_api_secret=settings.TG_SECRET_KEY
)
```

## License

Proprietary. © AFEX Innovation Lab.
