Core modules: - Laws: CRUD, search, AI-powered QA - Analysis: legal research and case management - Contracts: lifecycle management with templates - Signatures: electronic signature workflow Infrastructure: - FastAPI + SQLite + async SQLAlchemy - Docker deployment support - 54 unit tests passing Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
62 lines
1.4 KiB
Python
62 lines
1.4 KiB
Python
"""Schemas for Signature module."""
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from enum import Enum
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class SignatureStatusEnum(str, Enum):
|
|
PENDING = "pending"
|
|
SIGNED = "signed"
|
|
REJECTED = "rejected"
|
|
EXPIRED = "expired"
|
|
|
|
|
|
class SignatureRequestCreate(BaseModel):
|
|
"""Schema for creating a signature request."""
|
|
contract_id: int
|
|
signer_name: str = Field(..., max_length=100)
|
|
signer_email: str = Field(..., max_length=100)
|
|
expire_hours: Optional[int] = None
|
|
|
|
|
|
class SignatureRequestResponse(BaseModel):
|
|
"""Schema for signature request response."""
|
|
id: int
|
|
contract_id: int
|
|
requester_id: int
|
|
signer_name: str
|
|
signer_email: str
|
|
status: SignatureStatusEnum
|
|
token: str
|
|
expires_at: datetime
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class SignatureSignRequest(BaseModel):
|
|
"""Schema for signing a document."""
|
|
signature_data: str # Base64 image or coordinates
|
|
|
|
|
|
class SignatureResponse(BaseModel):
|
|
"""Schema for signature response."""
|
|
id: int
|
|
request_id: int
|
|
signer_name: str
|
|
signed_at: datetime
|
|
verification_hash: str
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class SignatureVerifyResponse(BaseModel):
|
|
"""Schema for signature verification response."""
|
|
valid: bool
|
|
signed_at: Optional[datetime] = None
|
|
signer_name: Optional[str] = None
|