"""Shared models for HeyReach LinkedIn outbound jobs."""

from __future__ import annotations

from typing import Dict, Optional

from pydantic import BaseModel, Field


class SourceInfo(BaseModel):
    spreadsheet_id: str
    sheet_name: str
    range_a1: str
    row_count: Optional[int] = None


class HeyReachMapping(BaseModel):
    email: str
    linkedin_url: str
    first_name: Optional[str] = None
    last_name: Optional[str] = None
    company: Optional[str] = None
    title: Optional[str] = None
    sender_account_id: Optional[str] = None
    custom_vars: Dict[str, str] = Field(default_factory=dict)


class HeyReachWriteback(BaseModel):
    enabled: bool = True
    status_column: str = "HeyReach Status"
    campaign_column: str = "HeyReach Campaign"
    lead_id_column: str = "HeyReach Lead ID"
    pushed_at_column: str = "HeyReach Pushed At"
    error_column: str = "HeyReach Error"


class HeyReachConfig(BaseModel):
    profile_id: str
    campaign_id: str
    source: SourceInfo
    starting_row: int
    mapping: HeyReachMapping
    writeback: HeyReachWriteback = Field(default_factory=HeyReachWriteback)
    upload_id: Optional[str] = None
    row_count: Optional[int] = None
    notify_email: Optional[str] = None
    spreadsheet_url: Optional[str] = None
