// Auto-generated TypeScript declarations for the LN SDK.
// Source: OpenAPI spec at /api/openapi.json
// Split files available at /_sdk/types/{enums,models,api}.d.ts

// Auto-generated enum types for the LN SDK.

type BillingCycleEnum = 'monthly' | 'quarterly' | 'semi_annual' | 'yearly';

type ContentSideEnum = 'supply' | 'demand';

type ForkMode = 'fork' | 'theme';

type InquiryChannel = 'email' | 'phone' | 'sms' | 'chat' | 'portal' | 'walk_in';

type Priority = 'low' | 'normal' | 'high' | 'urgent';

type RoleEnum = 'admin' | 'organization_admin' | 'member' | 'editor';

/** Response detail level. */
type View = 'summary' | 'standard' | 'full';

type ViewingType = 'in_person' | 'virtual';

type VisibilityEnum = 'private' | 'organization' | 'network' | 'public';


// Auto-generated model interfaces for the LN SDK.

interface AddBundleItemRequest {
  capability: string;
  credit_cost?: number;
  grant_type: string;
  quota_spec?: null | QuotaSpec;
}

interface AddHostnameRequest {
  is_primary?: boolean;
  name: string;
  redirect_mode?: string;
  serves_preview?: boolean;
}

interface AddMemberRequest {
  role: RoleEnum;
  user_id: SnowflakeId;
}

interface AgriculturalWire {
  elevation_range?: null | IntRange;
  existing_crops?: string[];
  existing_livestock?: string[];
  flood_prone?: boolean;
  intended_uses?: string[];
  irrigation_options?: string[];
  is_foreclosed?: boolean;
  land_classifications?: string[];
  lot_area?: null | AreaWire;
  notes?: string;
  power_options?: string[];
  road_access?: string[];
  slope_levels?: string[];
  soil_types?: string[];
  tenancy_status?: string[];
  title_statuses?: string[];
  water_sources?: string[];
}

/** API key row. Exactly one of `organization_id` (service/org key) or
`user_id` (personal key) is non-null. Both transport via `Authorization:
Bearer <ln_ak_...>` or HTTP basic with the plaintext key as password. */
interface ApiKey {
  created_at: string;
  expires_at: string;
  id: SnowflakeId;
  last_used_at?: string;
  name: string;
  organization_id?: null | SnowflakeId;
  /** First N chars of the plaintext for leak detection + display. Safe to
log and show. Never the full key. */
  prefix: string;
  revoked_at?: string;
  scopes?: string[];
  updated_at: string;
  user_id?: null | SnowflakeId;
}

type ApiKeyCreated = ApiKey & { raw_key: string };

interface AppliancesWire {
  brand_id?: number;
  capacity_range?: null | NumRange;
  capacity_unit?: string;
  colors?: string[];
  condition?: string[];
  delivery_included?: boolean;
  depth_mm_range?: null | IntRange;
  energy_rating?: string;
  features?: string[];
  height_mm_range?: null | IntRange;
  installation_included?: boolean;
  is_negotiable?: boolean;
  model_number?: string;
  notes?: string;
  power_watts_range?: null | IntRange;
  voltage_range?: null | IntRange;
  warranty_months_remaining_range?: null | IntRange;
  width_mm_range?: null | IntRange;
  year_range?: null | IntRange;
}

/** Grouped area measurement: original range + unit. */
interface AreaWire {
  range: NumRange;
  unit: string;
}

/** API response type for asset attachments — includes resolved URL and asset metadata. */
interface AssetResponse {
  created_at: string;
  filename?: string;
  id: SnowflakeId;
  label?: string;
  mime_type: string;
  role: string;
  size: number;
  sort_order: number;
  url: string;
}

interface AuthResponse {
  access_token: string;
  refresh_token: string;
}

interface BootstrapOrgOut {
  id: string;
  name: string;
  slug: string;
}

interface BootstrapRequest {
  email: string;
  /** Marketing hostname (site 0). The admin site (site 1) is derived as
`admin.{hostname}` and reserved at the platform level. */
  hostname: string;
  name: string;
  password: string;
}

interface BootstrapResponse {
  admin_site: BootstrapSiteOut;
  /** Plaintext API key — returned once, never retrievable again. */
  api_key: string;
  org: BootstrapOrgOut;
  site: BootstrapSiteOut;
  user: BootstrapUserOut;
}

interface BootstrapSiteOut {
  hostname: string;
  id: string;
}

interface BootstrapUserOut {
  email: string;
  id: string;
  name: string;
}

interface BrokerageCooperationWire {
  commission_split_pct_range?: null | NumRange;
  exclusivity_required?: boolean;
  experience_years_range?: null | IntRange;
  lead_sources?: string[];
  licenses?: string[];
  marketing_support_provided?: boolean;
  notes?: string;
  specializations?: string[];
  term_months_range?: null | IntRange;
  territories_psgc_codes?: string[];
  transactions_per_year_range?: null | IntRange;
}

interface BuildingMaterialsWire {
  bulk_discount_available?: boolean;
  condition?: string[];
  dimensions_per_unit?: string;
  manufacturer_id?: number;
  material_grade?: string;
  notes?: string;
  pickup_only?: boolean;
  quantity_range?: null | NumRange;
  quantity_unit?: string;
}

interface Bundle {
  created_at: string;
  description?: string;
  id: SnowflakeId;
  name: string;
  slug?: string;
  status: string;
  updated_at: string;
}

interface BundleItem {
  bundle_id: SnowflakeId;
  capability: string;
  created_at: string;
  credit_cost?: number;
  grant_type: string;
  id: SnowflakeId;
  quota?: number;
  quota_window?: string;
  updated_at: string;
}

interface BundlePrice {
  amount: string;
  billing_cycle: BillingCycleEnum;
  bundle_id: SnowflakeId;
  created_at: string;
  currency?: string;
  effective_from: string;
  effective_to?: string;
  id: SnowflakeId;
  updated_at: string;
}

interface CatalogEntry {
  code: string;
  description: string;
}

interface ChangePasswordRequest {
  current_password: string;
  new_password: string;
}

interface CommercialWire {
  building_class?: string[];
  ceiling_height_m_range?: null | NumRange;
  corner_lot?: boolean;
  floor_area?: null | AreaWire;
  foot_traffic?: string[];
  frontage_m_range?: null | NumRange;
  going_concern?: boolean;
  intended_business?: string[];
  is_foreclosed?: boolean;
  is_pre_selling?: boolean;
  lot_area?: null | AreaWire;
  notes?: string;
  parking_spaces_range?: null | IntRange;
  title_statuses?: string[];
  traffic_facing?: boolean;
}

interface ConstructionWire {
  bonded?: boolean;
  completed_projects_range?: null | IntRange;
  coverage_radius_km_range?: null | IntRange;
  crew_size_range?: null | IntRange;
  equipment_owned?: string[];
  fee_structure?: string;
  insured?: boolean;
  licenses?: string[];
  notes?: string;
  project_size_range?: null | NumRange;
  project_types?: string[];
  safety_certifications?: string[];
  years_experience_range?: null | IntRange;
}

type ContentAttrsWire = ResidentialWire & { category: 'residential' } | CommercialWire & { category: 'commercial' } | IndustrialWire & { category: 'industrial' } | AgriculturalWire & { category: 'agricultural' } | VacantLotWire & { category: 'vacant_lot' } | MemorialWire & { category: 'memorial' } | DueDiligenceWire & { category: 'due_diligence' } | TransactionWire & { category: 'transaction' } | FinancialWire & { category: 'financial' } | LegalWire & { category: 'legal' } | MediaServiceWire & { category: 'media' } | MarketingWire & { category: 'marketing' } | ManagementWire & { category: 'management' } | ConstructionWire & { category: 'construction' } | RelocationWire & { category: 'relocation' } | FurnitureWire & { category: 'furniture' } | AppliancesWire & { category: 'appliances' } | FixturesAndLightingWire & { category: 'fixtures_and_lighting' } | BuildingMaterialsWire & { category: 'building_materials' } | ToolsAndEquipmentWire & { category: 'tools_and_equipment' } | VehiclesAndMachineryWire & { category: 'vehicles_and_machinery' } | DecorAndFurnishingsWire & { category: 'decor_and_furnishings' } | OutdoorAndLandscapingWire & { category: 'outdoor_and_landscaping' } | JointVentureWire & { category: 'joint_venture' } | InvestmentWire & { category: 'investment' } | FranchiseWire & { category: 'franchise' } | BrokerageCooperationWire & { category: 'brokerage_cooperation' } | ServiceAllianceWire & { category: 'service_alliance' } | MentorshipWire & { category: 'mentorship' };

/** Universal content fields shared across all categories.
Excludes `search_vector` (tsvector) and `location_path` (ltree) which
are trigger/generated and not representable in sqlx. */
interface ContentHeader {
  allow_reshare: boolean;
  author_id: SnowflakeId;
  category: string;
  content_type: string;
  created_at: string;
  description?: string;
  id: SnowflakeId;
  intended_for?: null | SnowflakeId;
  organization_id: SnowflakeId;
  psgc_codes: string[];
  side: ContentSideEnum;
  status: string;
  subtypes: string[];
  title: string;
  transaction_types?: string[];
  updated_at: string;
  visibility: VisibilityEnum;
}

/** Full match with resolved org projections. */
interface ContentMatchResponse {
  content_a_id: SnowflakeId;
  content_b_id: SnowflakeId;
  created_at: string;
  dismissed_by_a?: null | SnowflakeId;
  dismissed_by_a_at?: string;
  dismissed_by_b?: null | SnowflakeId;
  dismissed_by_b_at?: string;
  factors: any;
  id: SnowflakeId;
  org_a?: null | OrgSummary;
  org_a_id: SnowflakeId;
  org_b?: null | OrgSummary;
  org_b_id: SnowflakeId;
  profile: string;
  score: number;
  updated_at: string;
}

interface ContentOverride {
  content_id: SnowflakeId;
  created_at: string;
  created_by: SnowflakeId;
  id: SnowflakeId;
  target_organization_id?: null | SnowflakeId;
  target_user_id?: null | SnowflakeId;
  updated_at: string;
}

/** Content override with resolved org projection. */
interface ContentOverrideResponse {
  content_id: SnowflakeId;
  created_at: string;
  created_by: SnowflakeId;
  id: SnowflakeId;
  target_organization?: null | OrgSummary;
  target_organization_id?: null | SnowflakeId;
  target_user_id?: null | SnowflakeId;
  updated_at: string;
}

interface ContentReshare {
  content_id: SnowflakeId;
  created_at: string;
  id: SnowflakeId;
  reshared_by: SnowflakeId;
  reshared_organization_id: SnowflakeId;
  target_organization_id?: null | SnowflakeId;
  updated_at: string;
  visibility: VisibilityEnum;
}

/** Content reshare with resolved org projections. */
interface ContentReshareResponse {
  content_id: SnowflakeId;
  created_at: string;
  id: SnowflakeId;
  reshared_by: SnowflakeId;
  reshared_organization?: null | OrgSummary;
  reshared_organization_id: SnowflakeId;
  target_organization?: null | OrgSummary;
  target_organization_id?: null | SnowflakeId;
  updated_at: string;
  visibility: VisibilityEnum;
}

type ContentResponse = ContentHeader & { attrs?: null | ContentAttrsWire; author?: null | UserSummary; organization?: null | OrgSummary; price?: null | PriceWire };

type ContentStandard = ContentHeader & { author?: null | UserSummary; organization?: null | OrgSummary; price?: null | PriceWire };

interface ContentStatsDaily {
  content_id: SnowflakeId;
  created_at: string;
  date: string;
  inquiries: number;
  saves: number;
  shares: number;
  unique_views: number;
  updated_at: string;
  views: number;
}

interface CreateApiKeyRequest {
  /** Optional explicit expiry. If omitted, defaults to
`auth.default_api_key_ttl` from config (default 365 days). */
  expires_at?: string;
  name: string;
  scopes?: string[];
}

interface CreateBundlePriceRequest {
  amount: string;
  billing_cycle: BillingCycleEnum;
  currency: string;
  effective_from: string;
  effective_to?: string;
}

interface CreateBundleRequest {
  description?: string;
  name: string;
}

/** Create a content item. `side` and `content_type` come from the route. */
interface CreateContentBody {
  attrs: ContentAttrsWire;
  /** Category within the content type (residential, commercial, etc.). */
  category: string;
  description?: string;
  /** Target member user ID (required for Editors, optional for admins). */
  intended_for?: number;
  /** Price currency (defaults to PHP). */
  price_currency?: string;
  /** Price period: one_time, monthly, yearly, etc. */
  price_period?: string;
  price_range?: number[];
  /** Price unit: total, sqm, etc. */
  price_unit?: string;
  psgc_codes: string[];
  subtypes: string[];
  title?: string;
  transaction_types?: string[];
  visibility?: null | VisibilityEnum;
}

interface CreateEdgeRequest {
  content_id: SnowflakeId;
  role: string;
  to_organization_id: SnowflakeId;
}

interface CreateEventRequest {
  data?: null | Value;
  event_type?: string;
  title: string;
  visibility?: string;
}

interface CreateInquiryRequest {
  data?: any;
  demand_content_id?: null | SnowflakeId;
  source: string;
  supply_content_id?: null | SnowflakeId;
  to_user_id?: null | SnowflakeId;
}

interface CreateInvoiceLineRequest {
  amount: string;
  description: string;
  quantity: string;
  type: string;
  unit_price?: string;
}

interface CreateInvoiceRequest {
  due_date: string;
  notes?: string;
  period_end: string;
  period_start: string;
}

interface CreateManagedDomainRequest {
  name: string;
}

interface CreateOrgRelationshipRequest {
  data?: any;
  to_organization_id: SnowflakeId;
  type: string;
}

interface CreateOrganizationRequest {
  data?: any;
  name: string;
  slug?: string;
}

interface CreateOverrideRequest {
  capability: string;
  credit_cost?: number;
  grant_type: string;
  price?: string;
  quota_spec?: null | QuotaSpec;
  reason?: string;
}

interface CreatePackRequest {
  credits: number;
  name: string;
  price: string;
}

interface CreatePaymentRequest {
  amount: string;
  currency?: string;
  invoice_id: SnowflakeId;
  notes?: string;
  payment_method: string;
  payment_reference?: string;
}

interface CreateRegistrationRequest {
  data?: null | Value;
  role?: string;
  user_id?: null | SnowflakeId;
}

interface CreateReservedSubdomainRequest {
  /** Single subdomain label (lowercase alnum + hyphen, 1–63 chars, no
leading/trailing hyphen). Normalized via trim + lowercase before
validation. */
  name: string;
  /** Optional free-text reason for the reservation. Surfaced in admin UI. */
  reason?: string;
}

interface CreateSessionRequest {
  data?: null | Value;
  session_type?: string;
  sort_order: number;
  title: string;
}

interface CreateShareLinkRequest {
  /** How long the link should be valid, e.g. "7d", "24h", "30m".
Omit for a link that never expires. */
  expires_in?: string;
}

interface CreateSiteRequest {
  description?: string;
  from_site_id?: null | SnowflakeId;
  /** Optional source: fork an existing site by slug. */
  from_site_slug?: string;
  mode?: null | ForkMode;
  name: string;
  /** URL-safe identifier. Must be unique across the instance.
Used for the auto-allocated preview hostname and as a human-readable
alternative to the numeric site ID. */
  slug: string;
  visibility?: null | VisibilityEnum;
}

interface CreateUserRelationshipRequest {
  data?: any;
  type: string;
  user_id: SnowflakeId;
}

interface CreateViewingRequest {
  data?: any;
  demand_content_id?: null | SnowflakeId;
  source: string;
  supply_content_id?: null | SnowflakeId;
  to_user_id?: null | SnowflakeId;
}

interface CreditBalanceResponse {
  balance: number;
  organization_id: SnowflakeId;
}

interface CreditPack {
  created_at: string;
  credits: number;
  id: SnowflakeId;
  name: string;
  price: string;
  status: string;
  updated_at: string;
}

interface CreditPurchase {
  amount: string;
  created_at: string;
  credit_pack_id: SnowflakeId;
  credits_received: number;
  currency?: string;
  id: SnowflakeId;
  organization_id: SnowflakeId;
  payment_method: string;
  payment_reference?: string;
  status: string;
  updated_at: string;
}

interface CreditTransaction {
  amount: number;
  capability?: string;
  created_at: string;
  credit_pack_id?: null | SnowflakeId;
  expires_at?: string;
  id: SnowflakeId;
  note?: string;
  organization_id: SnowflakeId;
  reference_id?: null | SnowflakeId;
  type: string;
}

type DateTimeRange = string[];

interface DecorAndFurnishingsWire {
  colors?: string[];
  condition?: string[];
  dimensions_mm_range?: null | IntRange;
  material?: string[];
  notes?: string;
  room_suitability?: string[];
  style?: string[];
}

interface DeleteFileRequest {
  base_ref?: string;
  message: string;
}

interface DeletedResponse {
  deleted: boolean;
}

interface DiffFileResponse {
  path: string;
  status: string;
}

interface DiffResponse {
  files: DiffFileResponse[];
  patch: string;
}

interface DisableTotpRequest {
  password: string;
}

interface DistributionEdge {
  content_id: SnowflakeId;
  created_at: string;
  from_organization_id: SnowflakeId;
  id: SnowflakeId;
  role: string;
  to_organization_id: SnowflakeId;
  updated_at: string;
}

/** Distribution edge with resolved org projections. */
interface DistributionEdgeResponse {
  content_id: SnowflakeId;
  created_at: string;
  from_organization?: null | OrgSummary;
  from_organization_id: SnowflakeId;
  id: SnowflakeId;
  role: string;
  to_organization?: null | OrgSummary;
  to_organization_id: SnowflakeId;
  updated_at: string;
}

interface DueDiligenceWire {
  accepts_rush?: boolean;
  certifications?: string[];
  coverage_radius_km_range?: null | IntRange;
  experience_years_range?: null | IntRange;
  fee_structure?: string;
  languages?: string[];
  next_available_range?: null | DateTimeRange;
  notes?: string;
  on_site_required?: boolean;
  portfolio_size_range?: null | IntRange;
  response_time_hours_range?: null | IntRange;
  service_scope?: string[];
  target_categories?: string[];
}

interface EnableTotpRequest {
  code: string;
}

interface Event {
  created_at: string;
  created_by?: null | SnowflakeId;
  data?: any;
  event_type?: string;
  id: SnowflakeId;
  organization_id: SnowflakeId;
  status: string;
  title: string;
  updated_at: string;
  visibility: string;
}

interface EventRegistration {
  created_at: string;
  data?: any;
  event_id: SnowflakeId;
  id: SnowflakeId;
  invited_by?: null | SnowflakeId;
  invoice_id?: null | SnowflakeId;
  payment_window_expires?: string;
  queue_position?: number;
  role: string;
  status: string;
  updated_at: string;
  user_id?: null | SnowflakeId;
}

interface EventSession {
  created_at: string;
  created_by?: null | SnowflakeId;
  data?: any;
  event_id?: null | SnowflakeId;
  id: SnowflakeId;
  organization_id: SnowflakeId;
  session_type?: string;
  sort_order: number;
  title: string;
  updated_at: string;
}

/** A single bucket in a faceted count result. */
interface FacetBucket {
  count: number;
  label?: string;
  value: string;
}

/** Response from a faceted count query. */
interface FacetResponse {
  facets: Record<string, FacetBucket[]>;
  total: number;
}

interface FileWrite {
  /** Base64-encoded file content. */
  content: string;
  path: string;
}

interface FinancialWire {
  branch_offices_range?: null | IntRange;
  commission_pct_range?: null | NumRange;
  fee_structure?: string;
  interest_rate_pct_range?: null | NumRange;
  lender_network?: string[];
  licenses?: string[];
  loan_amount_range?: null | NumRange;
  loan_term_years_range?: null | IntRange;
  notes?: string;
  property_types_supported?: string[];
  years_in_business_range?: null | IntRange;
}

interface FixturesAndLightingWire {
  compatible_systems?: string[];
  condition?: string[];
  dimensions_mm_range?: null | IntRange;
  finish?: string[];
  installation_difficulty?: string;
  material?: string[];
  notes?: string;
  power_consumption_watts_range?: null | IntRange;
  style?: string[];
}

interface ForgotPasswordRequest {
  email: string;
}

interface ForgotPasswordResponse {
  message: string;
  reset_token?: string;
}

interface FranchiseWire {
  brand_id?: number;
  exclusive_territory?: boolean;
  existing_locations_range?: null | IntRange;
  marketing_fee_pct_range?: null | NumRange;
  min_capital_required_range?: null | NumRange;
  notes?: string;
  royalty_pct_range?: null | NumRange;
  success_rate_pct_range?: null | NumRange;
  support_provided?: string[];
  term_years_range?: null | IntRange;
  territory_psgc_codes?: string[];
  training_provided?: string[];
}

interface FurnitureWire {
  assembly_required?: boolean;
  colors?: string[];
  condition?: string[];
  delivery_included?: boolean;
  depth_mm_range?: null | IntRange;
  height_mm_range?: null | IntRange;
  materials?: string[];
  notes?: string;
  style?: string[];
  weight_kg_range?: null | NumRange;
  width_mm_range?: null | IntRange;
  year_range?: null | IntRange;
}

interface HealthResponse {
  status: string;
}

interface ImportBundlesRequest {
  /** Filesystem path to a bundles YAML file. Resolved relative to the api
process's cwd. Operators typically pass `"bundles.yml"`. */
  path: string;
}

interface ImportBundlesResponse {
  bundles_upserted: number;
  items_removed: number;
  items_upserted: number;
}

interface IndustrialWire {
  ceiling_height_m_range?: null | NumRange;
  column_spacing_m_range?: null | NumRange;
  crane_options?: string[];
  floor_area?: null | AreaWire;
  floor_load_capacity_kpa_range?: null | NumRange;
  forklift_access?: boolean;
  is_foreclosed?: boolean;
  loading_docks_range?: null | IntRange;
  lot_area?: null | AreaWire;
  notes?: string;
  office_space_sqm_range?: null | NumRange;
  power_capacity_kw_range?: null | NumRange;
  power_phase?: string[];
  temperature_control?: string[];
  title_statuses?: string[];
  truck_access?: string[];
}

interface InquiryData {
  channel?: null | InquiryChannel;
  contact_email?: string;
  contact_name?: string;
  contact_phone?: string;
  message?: string;
  priority?: null | Priority;
  proposed_date?: string;
  [key: string]: any;
}

type IntRange = number[];

interface Interaction {
  created_at: string;
  data: InteractionData;
  demand_content_id?: null | SnowflakeId;
  from_user_id?: null | SnowflakeId;
  id: SnowflakeId;
  interaction_type: string;
  organization_id: SnowflakeId;
  proposed_date?: string;
  source: string;
  status: string;
  supply_content_id?: null | SnowflakeId;
  to_user_id?: null | SnowflakeId;
  updated_at: string;
}

/** Type-dispatched interaction data. Each variant corresponds to an
`interaction_type` value and defines the expected JSONB shape. */
type InteractionData = InquiryData | ViewingRequestData | ResponseData | SystemMatchData | NoteData;

interface InvestmentWire {
  accredited_investor_required?: boolean;
  asset_classes?: string[];
  distribution_frequency?: string[];
  expected_return_pct_range?: null | NumRange;
  holding_period_years_range?: null | IntRange;
  lock_up_period_months_range?: null | IntRange;
  minimum_investment_range?: null | NumRange;
  notes?: string;
  prior_returns_pct_range?: null | NumRange;
  risk_tolerance?: string[];
  secured_by?: string[];
  track_record_years_range?: null | IntRange;
}

interface Invoice {
  checkout_session_id?: string;
  created_at: string;
  currency?: string;
  due_date: string;
  id: SnowflakeId;
  notes?: string;
  organization_id: SnowflakeId;
  paid_at?: string;
  payment_url?: string;
  period_end: string;
  period_start: string;
  sent_at?: string;
  status: string;
  subtotal: string;
  total_adjustments: string;
  total_amount: string;
  updated_at: string;
}

interface InvoiceLine {
  amount: string;
  created_at: string;
  description: string;
  id: SnowflakeId;
  invoice_id: SnowflakeId;
  quantity?: string;
  type: string;
  unit_price?: string;
  updated_at: string;
}

type InvoiceWithLines = Invoice & { lines: InvoiceLine[] };

interface JointVentureWire {
  contribution_types?: string[];
  equity_pct_range?: null | NumRange;
  exit_strategies?: string[];
  experience_years_range?: null | IntRange;
  is_first_time?: boolean;
  max_concurrent_projects_range?: null | IntRange;
  notes?: string;
  offering_roles?: string[];
  open_to_minority_stake?: boolean;
  project_categories?: string[];
  requires_legal_due_diligence?: boolean;
  risk_tolerance?: string[];
  seeking_roles?: string[];
  specializations?: string[];
  target_irr_pct_range?: null | NumRange;
  target_market_segments?: string[];
  timeline_years_range?: null | IntRange;
}

interface LegalWire {
  accepts_pro_bono?: boolean;
  bar_admissions?: string[];
  case_volume_range?: null | IntRange;
  experience_years_range?: null | IntRange;
  fee_structure?: string;
  notes?: string;
  practice_areas?: string[];
}

/** Multipart body schema for `POST /listings/{content_type}/{id}/media`.
Field shapes match the runtime `Multipart` extractor; this struct exists
only to populate the OpenAPI `request_body` definition. */
interface ListingMediaUpload {
  /** Media file bytes. */
  file: string;
  /** Human-readable label shown alongside the asset. */
  label?: string;
  /** Attachment role (e.g. `photo`, `video`, `document`). Optional — repo
supplies a default when omitted. */
  role?: string;
  /** Sort order within the content's attachment list. */
  sort_order?: number;
}

interface LogEntryResponse {
  author: string;
  date: string;
  hash: string;
  message: string;
}

interface LoginRequest {
  email: string;
  password: string;
}

interface ManagedDomain {
  created_at: string;
  id: SnowflakeId;
  name: string;
  status: string;
  updated_at: string;
}

interface ManagementWire {
  available_24_7?: boolean;
  bonded?: boolean;
  coverage_radius_km_range?: null | IntRange;
  fee_structure?: string;
  insured?: boolean;
  licenses?: string[];
  notes?: string;
  portfolio_size_range?: null | IntRange;
  property_types_supported?: string[];
  response_time_hours_range?: null | IntRange;
  service_frequency?: string[];
  team_size_range?: null | IntRange;
}

interface MarketingWire {
  case_studies_range?: null | IntRange;
  conversion_rate_pct_range?: null | NumRange;
  fee_structure?: string;
  lead_volume_range?: null | IntRange;
  monthly_budget_range?: null | NumRange;
  notes?: string;
  platforms?: string[];
  target_audiences?: string[];
  tracked_metrics?: string[];
  years_experience_range?: null | IntRange;
}

interface MeResponse {
  capabilities?: string[];
  org?: null | OrgStandard;
  role?: null | RoleEnum;
  user?: null | MeUser;
}

interface MeUser {
  email: string;
  id: SnowflakeId;
  name?: string;
}

interface MediaServiceWire {
  deliverable_formats?: string[];
  equipment?: string[];
  fee_structure?: string;
  notes?: string;
  package_tier?: string[];
  portfolio_size_range?: null | IntRange;
  specializations?: string[];
  style?: string[];
  turnaround_days_range?: null | IntRange;
  years_experience_range?: null | IntRange;
}

interface Membership {
  created_at: string;
  data?: any;
  id: SnowflakeId;
  invited_by?: null | SnowflakeId;
  organization_id: SnowflakeId;
  role: RoleEnum;
  source: string;
  status: string;
  updated_at: string;
  user_id: SnowflakeId;
}

/** Membership with resolved user projection (CR-010).

For public (anonymous) access, `source` and `invited_by` are omitted and
`user` contains only opted-in profile data. For authenticated org member
access, all fields are present and `user` contains standard fields for
all users regardless of opt-in. */
interface MembershipResponse {
  created_at: string;
  id: SnowflakeId;
  invited_by?: null | SnowflakeId;
  organization_id: SnowflakeId;
  role: RoleEnum;
  source?: string;
  status: string;
  updated_at: string;
  user?: null | UserStandard;
  user_id: SnowflakeId;
}

/** Membership row joined with its organization's standard projection.
Used by the `GET /me/memberships` endpoint. */
interface MembershipWithOrg {
  created_at: string;
  id: SnowflakeId;
  is_personal: boolean;
  organization_id: SnowflakeId;
  organization_name: string;
  organization_slug?: string;
  role: RoleEnum;
  status: string;
  user_id: SnowflakeId;
}

interface MemorialWire {
  capacity_persons_range?: null | IntRange;
  cemetery_id?: number;
  existing_remains_count_range?: null | IntRange;
  level?: string;
  maintenance_included?: boolean;
  notes?: string;
  perpetual_care?: boolean;
  religion?: string[];
  section?: string;
}

interface MentorshipWire {
  certification_provided?: boolean;
  cohort_size_range?: null | IntRange;
  coverage_psgc_codes?: string[];
  experience_offered_years_range?: null | IntRange;
  experience_sought_years_range?: null | IntRange;
  format?: string[];
  meeting_frequency?: string[];
  notes?: string;
  specializations?: string[];
  time_commitment_hours_per_month_range?: null | NumRange;
}

interface MoveHostnameRequest {
  target_site_id: SnowflakeId;
}

interface NoteData {
  message?: string;
  priority?: null | Priority;
  [key: string]: any;
}

type NumRange = number[];

/** Multipart body schema for `POST /organization/asset`. The `role` field
lives on the URL as a query parameter; only the file bytes are in the body. */
interface OrgAssetUpload {
  /** Asset file bytes (logo or favicon). */
  file: string;
}

interface OrgBillingProfile {
  billing_anchor_date: string;
  billing_cycle: BillingCycleEnum;
  created_at: string;
  organization_id: SnowflakeId;
  pending_billing_cycle?: null | BillingCycleEnum;
  pending_effective_date?: string;
  updated_at: string;
  updated_by?: null | SnowflakeId;
}

interface OrgCapability {
  capability: string;
  created_at: string;
  credit_cost?: number;
  grant_type: string;
  id: SnowflakeId;
  organization_id: SnowflakeId;
  quota?: number;
  quota_window?: string;
  source: string;
  updated_at: string;
}

interface OrgCapabilityOverride {
  capability: string;
  created_at: string;
  credit_cost?: number;
  grant_type: string;
  id: SnowflakeId;
  organization_id: SnowflakeId;
  price?: string;
  quota?: number;
  quota_window?: string;
  reason?: string;
  updated_at: string;
}

interface OrgRelationship {
  created_at: string;
  data?: any;
  expires_at?: string;
  from_organization_id: SnowflakeId;
  id: SnowflakeId;
  started_at?: string;
  status: string;
  to_organization_id: SnowflakeId;
  type: string;
  updated_at: string;
}

/** Org identity + settings. Used by OrgContext and in responses that need
org configuration (e.g. /me, window.__LN.org) but not the full data blob. */
interface OrgStandard {
  accepts_applications: boolean;
  id: SnowflakeId;
  is_personal: boolean;
  member_directory: string;
  name: string;
  slug?: string;
  status: string;
}

interface OrgSubscription {
  bundle_id: SnowflakeId;
  created_at: string;
  current_period_end?: string;
  current_period_start?: string;
  id: SnowflakeId;
  organization_id: SnowflakeId;
  started_at: string;
  status: string;
  updated_at: string;
}

/** Minimal org info for embedding in other responses. */
interface OrgSummary {
  id: SnowflakeId;
  name: string;
  slug: string;
}

interface OrgUserRelationship {
  created_at: string;
  data?: any;
  expires_at?: string;
  id: SnowflakeId;
  organization_id: SnowflakeId;
  started_at?: string;
  status: string;
  type: string;
  updated_at: string;
  user_id: SnowflakeId;
}

interface Organization {
  accepts_applications: boolean;
  created_at: string;
  data?: any;
  id: SnowflakeId;
  is_personal: boolean;
  member_directory: string;
  name: string;
  public_invite_token?: string;
  slug?: string;
  status: string;
  updated_at: string;
}

interface OutdoorAndLandscapingWire {
  condition?: string[];
  dimensions_mm_range?: null | IntRange;
  installation_required?: boolean;
  material?: string[];
  notes?: string;
  power_source?: string[];
  weather_resistance?: string[];
}

interface OverrideRequest {
  content_id: SnowflakeId;
  target_organization_id?: null | SnowflakeId;
  target_user_id?: null | SnowflakeId;
}

interface Payment {
  amount: string;
  created_at: string;
  currency?: string;
  id: SnowflakeId;
  invoice_id: SnowflakeId;
  notes?: string;
  organization_id: SnowflakeId;
  payment_method: string;
  payment_reference?: string;
  received_by?: null | SnowflakeId;
  updated_at: string;
}

/** Grouped price: original range + currency/period/unit.
`rate` and canonical range are internal — not exposed. */
interface PriceWire {
  currency: string;
  period: string;
  range: NumRange;
  unit: string;
}

/** Promote request body. Unified endpoint covering both forward promotes
(promote draft tip or a specific commit) and rollback (re-promote an older
release by tag). */
interface PromoteRequest {
  /** Promote a specific commit on `draft` (must be reachable from `draft`).
Mutually exclusive with `tag`. */
  commit?: string;
  /** Required: commit message captured on the new `main` commit. */
  message: string;
  /** Re-promote an older release. Format: `release/N`. Mutually exclusive
with `commit`. Rollback produces a new `release/N+1` with the same
tree as the target. */
  tag?: string;
}

interface Psgc {
  city_class?: string;
  city_mun_code?: string;
  code: string;
  full_name: string;
  income_class?: string;
  level: string;
  name: string;
  parent_code?: string;
  path: string;
  population?: number;
  province_code?: string;
  region_code: string;
  urban_rural?: string;
}

/** Anonymous inquiry submission (public, no auth). */
interface PublicInquiryRequest {
  /** The content ID being inquired about. */
  content_id: number;
  /** Email of the inquiring person (required). */
  email: string;
  /** Message to the listing owner. */
  message?: string;
  /** Name of the inquiring person. */
  name?: string;
  /** Phone number. */
  phone?: string;
}

/** Anonymous requirement submission (public, no auth). */
interface PublicRequirementRequest {
  /** Category (e.g. residential). */
  category: string;
  /** Content type (defaults to real_estate). */
  content_type?: string;
  /** Description of what they're looking for. */
  description?: string;
  /** Email of the submitter (required). */
  email: string;
  /** Name of the submitter. */
  name?: string;
  /** Phone number. */
  phone?: string;
  psgc_codes: string[];
  subtypes: string[];
  /** Title of the requirement. */
  title?: string;
  transaction_types?: string[];
}

interface PurchaseRequest {
  credit_pack_id: SnowflakeId;
  payment_method: string;
  payment_reference?: string;
}

interface QuotaSpec {
  quota: number;
  /** ISO 8601 duration string (e.g. P1D, PT1H). Null means total (no rate window). */
  window?: string;
}

interface RefreshRequest {
  refresh_token: string;
}

interface RegisterRequest {
  email: string;
  name?: string;
  password: string;
}

interface RegisterResponse {
  message: string;
  verification_token: string;
}

interface Release {
  /** Commit SHA the tag points at. */
  commit: string;
  /** ISO-8601 creation time of the commit. */
  created_at: string;
  /** Promoter-supplied message from the commit. */
  message: string;
  /** Monotonically increasing per-site release counter parsed from the tag
(`release/N`). */
  release_number: number;
  /** Full tag name — `release/N`. */
  tag: string;
}

interface RelocationWire {
  crew_size_range?: null | IntRange;
  fee_structure?: string;
  insurance_included?: boolean;
  notes?: string;
  package_tier?: string[];
  same_day_available?: boolean;
  service_destination_psgc_codes?: string[];
  service_origin_psgc_codes?: string[];
  services_included?: string[];
  truck_capacity_cuft_range?: null | NumRange;
  years_experience_range?: null | IntRange;
}

interface ReservedSubdomain {
  created_at: string;
  name: string;
  reason?: string;
}

interface ResetPasswordRequest {
  new_password: string;
  token: string;
}

interface ReshareRequest {
  content_id: SnowflakeId;
  target_organization_id?: null | SnowflakeId;
  visibility: string;
}

interface ResidentialWire {
  amenities?: string[];
  availability_range?: null | DateTimeRange;
  bathrooms_range?: null | IntRange;
  bedrooms_range?: null | IntRange;
  developer_id?: number;
  financing_options?: string[];
  floor_area?: null | AreaWire;
  floor_range?: null | IntRange;
  furnishing_options?: string[];
  is_assumable?: boolean;
  is_foreclosed?: boolean;
  is_pre_selling?: boolean;
  lease_term_range?: null | DateTimeRange;
  lot_area?: null | AreaWire;
  notes?: string;
  parking_range?: null | IntRange;
  pet_friendly?: boolean;
  purchase_timeline?: string[];
  total_floors_range?: null | IntRange;
  views?: string[];
  year_built_range?: null | IntRange;
  year_renovated_range?: null | IntRange;
}

interface ResponseData {
  in_reply_to?: string;
  linked_content_id?: string;
  message?: string;
  priority?: null | Priority;
  [key: string]: any;
}

interface ServiceAllianceWire {
  co_branding?: boolean;
  exclusivity?: string[];
  marketing_commitment_range?: null | NumRange;
  min_volume_per_month_range?: null | IntRange;
  notes?: string;
  payment_structure?: string[];
  revenue_share_pct_range?: null | NumRange;
  service_categories?: string[];
  target_geographies?: string[];
  term_months_range?: null | IntRange;
  years_in_business_range?: null | IntRange;
}

interface Session {
  consumer_type: string;
  created_at: string;
  device_hash?: string;
  device_trusted: boolean;
  expires_at: string;
  id: SnowflakeId;
  last_refreshed_at?: string;
  updated_at: string;
  user_id: SnowflakeId;
}

interface ShareLinkResponse {
  created_at: string;
  expires_at?: string;
  id: SnowflakeId;
  permissions: string;
  resource_id: string;
  resource_type: string;
  token: string;
  url: string;
}

interface Site {
  created_at: string;
  deploy_ref: string;
  description?: string;
  draft_ref: string;
  forkable: boolean;
  forked_from_commit?: string;
  forked_from_id?: null | SnowflakeId;
  id: SnowflakeId;
  listed_as_template: boolean;
  name: string;
  organization_id: SnowflakeId;
  repo_path?: string;
  slug: string;
  status: string;
  theme_of?: null | SnowflakeId;
  updated_at: string;
  visibility: VisibilityEnum;
}

interface SiteHostname {
  cert_status?: string;
  created_at: string;
  id: SnowflakeId;
  is_primary: boolean;
  name: string;
  redirect_mode?: string;
  serves_preview: boolean;
  site_id: SnowflakeId;
  status: string;
  updated_at: string;
}

interface SiteHostnameStatsDaily {
  avg_time_seconds?: number;
  bounce_rate?: string;
  created_at: string;
  date: string;
  page_views: number;
  site_hostname_id: SnowflakeId;
  source_breakdown?: any;
  top_pages?: any;
  unique_visitors: number;
  updated_at: string;
}

type SnowflakeId = string;

interface StatusDefinition {
  code: string;
  created_at: string;
  entity_type: string;
  id: SnowflakeId;
  is_default: boolean;
  is_terminal: boolean;
  label: string;
  sort_order: number;
  updated_at: string;
}

interface StatusHistory {
  changed_by?: null | SnowflakeId;
  created_at: string;
  entity_id: SnowflakeId;
  entity_type: string;
  from_status?: string;
  id: SnowflakeId;
  reason?: string;
  to_status: string;
}

interface StatusTransition {
  created_at: string;
  entity_type: string;
  from_status: string;
  id: SnowflakeId;
  organization_id?: null | SnowflakeId;
  to_status: string;
}

interface SubscribeRequest {
  bundle_id: SnowflakeId;
}

interface SystemMatchData {
  match_factors?: any;
  match_score?: number;
  source_match_id?: string;
  [key: string]: any;
}

interface ToolsAndEquipmentWire {
  brand_id?: number;
  condition?: string[];
  included_accessories?: string[];
  notes?: string;
  power_source?: string[];
  power_specs_range?: null | IntRange;
  rental_period_days_range?: null | IntRange;
  year_range?: null | IntRange;
}

interface TotpChallengeResponse {
  challenge_token: string;
  requires_totp: boolean;
}

interface TotpRequest {
  challenge_token: string;
  code: string;
}

interface TotpSetupResponse {
  otpauth_uri: string;
  secret: string;
}

interface TransactionWire {
  accepts_remote_signing?: boolean;
  bonded_amount_range?: null | NumRange;
  certifications?: string[];
  coverage_radius_km_range?: null | IntRange;
  experience_years_range?: null | IntRange;
  fee_structure?: string;
  handles_government_filing?: boolean;
  next_available_range?: null | DateTimeRange;
  notes?: string;
  target_categories?: string[];
}

interface TreeEntryResponse {
  hash: string;
  mode: string;
  obj_type: string;
  path: string;
}

interface UpdateAdjustmentsRequest {
  total_adjustments: string;
}

interface UpdateContentBody {
  allow_reshare?: boolean;
  description?: string;
  /** Price currency. */
  price_currency?: string;
  /** Price period. */
  price_period?: string;
  price_range?: number[];
  /** Price unit. */
  price_unit?: string;
  psgc_codes?: string[];
  subtypes?: string[];
  title?: string;
  transaction_types?: string[];
  visibility?: null | VisibilityEnum;
}

interface UpdateDataRequest {
  data: any;
}

interface UpdateEventRequest {
  data?: null | Value;
  event_type?: string;
  title?: string;
  visibility?: string;
}

interface UpdateEventStatusRequest {
  reason?: string;
  status: string;
}

interface UpdateHostnameRequest {
  is_primary?: boolean;
  redirect_mode?: string;
}

interface UpdateInvoiceStatusRequest {
  reason?: string;
  status: string;
}

interface UpdateManagedDomainRequest {
  /** New status. One of `active`, `disabled`. */
  status: string;
}

interface UpdateMediaRequest {
  sort_order: number;
}

interface UpdateMembershipRoleRequest {
  role: RoleEnum;
}

interface UpdateMembershipStatusRequest {
  reason?: string;
  status: string;
}

interface UpdateOrganizationRequest {
  data?: any;
  member_directory?: string;
  name?: string;
  slug?: string;
}

interface UpdateOrganizationStatusRequest {
  reason?: string;
  status: string;
}

interface UpdatePackStatusRequest {
  reason?: string;
  status: string;
}

interface UpdateProfileRequest {
  data?: any;
  name?: string;
}

interface UpdateRegistrationStatusRequest {
  reason?: string;
  status: string;
}

interface UpdateRelationshipStatusRequest {
  reason?: string;
  status: string;
}

interface UpdateSiteStatusRequest {
  reason?: string;
  status: string;
}

interface UpdateStatusBody {
  reason?: string;
  status: string;
}

interface UpdateStatusRequest {
  reason?: string;
  status: string;
}

interface UpsertBillingProfileRequest {
  billing_anchor_date: string;
  billing_cycle: BillingCycleEnum;
}

/** Standard user projection for member listings and posted_as (CR-004, CR-010).
For anonymous access, only resolved for users with `data.public_profile = true`.
For authenticated org member access, resolved for all users. */
interface UserStandard {
  areas_served?: string;
  id: SnowflakeId;
  name?: string;
  phone?: string;
  photo?: string;
  prc_number?: string;
  specialization?: string;
}

/** Minimal user info for embedding in content responses (CR-012).
Always available — no opt-in gate. */
interface UserSummary {
  id: SnowflakeId;
  name?: string;
  photo?: string;
  prc_number?: string;
}

interface VacantLotWire {
  corner_lot?: boolean;
  frontage_m_range?: null | NumRange;
  intended_use_categories?: string[];
  is_foreclosed?: boolean;
  lot_area?: null | AreaWire;
  notes?: string;
  road_access?: string[];
  slope_levels?: string[];
  title_statuses?: string[];
  utilities_available?: string[];
}

type Value = any;

interface VehiclesAndMachineryWire {
  condition?: string[];
  engine_capacity_cc_range?: null | IntRange;
  fuel_type?: string[];
  make_id?: number;
  mileage_km_range?: null | IntRange;
  model?: string;
  notes?: string;
  or_cr_complete?: boolean;
  payload_capacity_tons_range?: null | NumRange;
  rental_period?: string[];
  transmission?: string[];
  year_range?: null | IntRange;
}

interface VerifyEmailRequest {
  token: string;
}

interface ViewingRequestData {
  attendees?: number;
  contact_name?: string;
  contact_phone?: string;
  notes?: string;
  priority?: null | Priority;
  proposed_date?: string;
  viewing_type?: null | ViewingType;
  [key: string]: any;
}

interface WriteFilesRequest {
  base_ref?: string;
  files: FileWrite[];
  message: string;
}

interface PaginationMeta {
  total: number;
  limit: number;
  offset: number;
  has_more: boolean;
}

interface ListResponse<T> {
  data: T[];
  pagination: PaginationMeta;
}

interface ApiErrorBody {
  error: {
    code: string;
    message: string;
    field?: string;
    capability?: string;
  };
}


// Auto-generated API method declarations for the LN SDK.

declare namespace LN {
  const org: { id: string; slug: string; name: string };
  const branding: { primary_color?: string; font?: string };
  const apiBase: string;

  class ApiError extends Error {
    readonly status: number;
    readonly code: string | null;
    readonly field: string | null;
    readonly capability: string | null;
    readonly body: ApiErrorBody | null;
    readonly rawText: string;
  }

  const analytics: {
    /** Org content stats */
    orgContentStats(params: { from: string; to: string }, _opts?: RequestInit): Promise<{ content_id: SnowflakeId; created_at: string; date: string; inquiries: number; saves: number; shares: number; unique_views: number; updated_at: string; views: number }[]>;
    /** Content stats */
    contentStats(id: SnowflakeId, params: { from: string; to: string }, _opts?: RequestInit): Promise<{ content_id: SnowflakeId; created_at: string; date: string; inquiries: number; saves: number; shares: number; unique_views: number; updated_at: string; views: number }[]>;
    /** Site hostname stats */
    siteHostnameStats(id: SnowflakeId, params: { from: string; to: string }, _opts?: RequestInit): Promise<{ avg_time_seconds?: number; bounce_rate?: string; created_at: string; date: string; page_views: number; site_hostname_id: SnowflakeId; source_breakdown?: any; top_pages?: any; unique_visitors: number; updated_at: string }[]>;
  };

  const apiKey: {
    /** List org API keys */
    list(_opts?: RequestInit): Promise<{ created_at: string; expires_at: string; id: SnowflakeId; last_used_at?: string; name: string; organization_id?: null | SnowflakeId; prefix: string; revoked_at?: string; scopes?: string[]; updated_at: string; user_id?: null | SnowflakeId }[]>;
    /** Create org API key */
    create(body: CreateApiKeyRequest, _opts?: RequestInit): Promise<ApiKey & { raw_key: string }>;
    /** Revoke org API key */
    delete(id: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** List personal API keys */
    listPersonal(_opts?: RequestInit): Promise<{ created_at: string; expires_at: string; id: SnowflakeId; last_used_at?: string; name: string; organization_id?: null | SnowflakeId; prefix: string; revoked_at?: string; scopes?: string[]; updated_at: string; user_id?: null | SnowflakeId }[]>;
    /** Create personal API key */
    createPersonal(body: CreateApiKeyRequest, _opts?: RequestInit): Promise<ApiKey & { raw_key: string }>;
    /** Revoke personal API key */
    revokePersonal(id: SnowflakeId, _opts?: RequestInit): Promise<void>;
  };

  const auth: {
    /** Request password reset */
    forgotPassword(body: ForgotPasswordRequest, _opts?: RequestInit): Promise<{ message: string; reset_token?: string }>;
    /** Log in with email and password */
    login(body: LoginRequest, _opts?: RequestInit): Promise<{ access_token: string; refresh_token: string }>;
    /** Log out and invalidate session */
    logout(_opts?: RequestInit): Promise<void>;
    /** Change password */
    changePassword(body: ChangePasswordRequest, _opts?: RequestInit): Promise<void>;
    /** Refresh access and refresh tokens */
    refresh(body: RefreshRequest, _opts?: RequestInit): Promise<{ access_token: string; refresh_token: string }>;
    /** Register a new account */
    register(body: RegisterRequest, _opts?: RequestInit): Promise<{ message: string; verification_token: string }>;
    /** Reset password with token */
    resetPassword(body: ResetPasswordRequest, _opts?: RequestInit): Promise<void>;
    /** List active sessions */
    listSessions(_opts?: RequestInit): Promise<{ consumer_type: string; created_at: string; device_hash?: string; device_trusted: boolean; expires_at: string; id: SnowflakeId; last_refreshed_at?: string; updated_at: string; user_id: SnowflakeId }[]>;
    /** Revoke a session */
    revokeSession(id: number, _opts?: RequestInit): Promise<void>;
    /** Complete TOTP verification */
    verifyTotp(body: TotpRequest, _opts?: RequestInit): Promise<{ access_token: string; refresh_token: string }>;
    /** Disable TOTP */
    totpDisable(body: DisableTotpRequest, _opts?: RequestInit): Promise<void>;
    /** Enable TOTP */
    totpEnable(body: EnableTotpRequest, _opts?: RequestInit): Promise<void>;
    /** Generate TOTP setup */
    totpSetup(_opts?: RequestInit): Promise<{ otpauth_uri: string; secret: string }>;
    /** Verify email address */
    verifyEmail(body: VerifyEmailRequest, _opts?: RequestInit): Promise<{ access_token: string; refresh_token: string }>;
  };

  const billing: {
    /** List invoices */
    listInvoices(params?: { sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ checkout_session_id?: string; created_at: string; currency?: string; due_date: string; id: SnowflakeId; notes?: string; organization_id: SnowflakeId; paid_at?: string; payment_url?: string; period_end: string; period_start: string; sent_at?: string; status: string; subtotal: string; total_adjustments: string; total_amount: string; updated_at: string }>>;
    /** Create invoice */
    createInvoice(body: CreateInvoiceRequest, _opts?: RequestInit): Promise<{ checkout_session_id?: string; created_at: string; currency?: string; due_date: string; id: SnowflakeId; notes?: string; organization_id: SnowflakeId; paid_at?: string; payment_url?: string; period_end: string; period_start: string; sent_at?: string; status: string; subtotal: string; total_adjustments: string; total_amount: string; updated_at: string }>;
    /** Get invoice with line items */
    getInvoice(id: SnowflakeId, params?: { view?: View }, _opts?: RequestInit): Promise<Invoice & { lines: InvoiceLine[] }>;
    /** Set invoice adjustments */
    updateInvoiceAdjustments(id: SnowflakeId, body: UpdateAdjustmentsRequest, _opts?: RequestInit): Promise<void>;
    /** Add invoice line item */
    createInvoiceLine(id: SnowflakeId, body: CreateInvoiceLineRequest, _opts?: RequestInit): Promise<{ amount: string; created_at: string; description: string; id: SnowflakeId; invoice_id: SnowflakeId; quantity?: string; type: string; unit_price?: string; updated_at: string }>;
    /** Update invoice status */
    updateInvoiceStatus(id: SnowflakeId, body: UpdateInvoiceStatusRequest, _opts?: RequestInit): Promise<void>;
    /** Delete invoice line item */
    deleteInvoiceLine(invoiceId: SnowflakeId, lineId: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** List payments */
    listPayments(params?: { sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ amount: string; created_at: string; currency?: string; id: SnowflakeId; invoice_id: SnowflakeId; notes?: string; organization_id: SnowflakeId; payment_method: string; payment_reference?: string; received_by?: null | SnowflakeId; updated_at: string }>>;
    /** Record payment */
    createPayment(body: CreatePaymentRequest, _opts?: RequestInit): Promise<{ amount: string; created_at: string; currency?: string; id: SnowflakeId; invoice_id: SnowflakeId; notes?: string; organization_id: SnowflakeId; payment_method: string; payment_reference?: string; received_by?: null | SnowflakeId; updated_at: string }>;
    /** Get billing profile */
    getProfile(_opts?: RequestInit): Promise<{ billing_anchor_date: string; billing_cycle: BillingCycleEnum; created_at: string; organization_id: SnowflakeId; pending_billing_cycle?: null | BillingCycleEnum; pending_effective_date?: string; updated_at: string; updated_by?: null | SnowflakeId }>;
    /** Create or update billing profile */
    upsertProfile(body: UpsertBillingProfileRequest, _opts?: RequestInit): Promise<{ billing_anchor_date: string; billing_cycle: BillingCycleEnum; created_at: string; organization_id: SnowflakeId; pending_billing_cycle?: null | BillingCycleEnum; pending_effective_date?: string; updated_at: string; updated_by?: null | SnowflakeId }>;
  };

  const capability: {
    /** Import bundles from a YAML file */
    importBundles(body: ImportBundlesRequest, _opts?: RequestInit): Promise<{ bundles_upserted: number; items_removed: number; items_upserted: number }>;
    /** List capability catalog */
    listCatalog(_opts?: RequestInit): Promise<{ code: string; description: string }[]>;
    /** List bundles */
    listBundles(_opts?: RequestInit): Promise<{ created_at: string; description?: string; id: SnowflakeId; name: string; slug?: string; status: string; updated_at: string }[]>;
    /** Create bundle */
    createBundle(body: CreateBundleRequest, _opts?: RequestInit): Promise<{ created_at: string; description?: string; id: SnowflakeId; name: string; slug?: string; status: string; updated_at: string }>;
    /** Add item to bundle */
    addBundleItem(id: SnowflakeId, body: AddBundleItemRequest, _opts?: RequestInit): Promise<{ bundle_id: SnowflakeId; capability: string; created_at: string; credit_cost?: number; grant_type: string; id: SnowflakeId; quota?: number; quota_window?: string; updated_at: string }>;
    /** Delete bundle item */
    deleteBundleItem(id: SnowflakeId, itemId: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** List bundle prices */
    listBundlePrices(id: SnowflakeId, _opts?: RequestInit): Promise<{ amount: string; billing_cycle: BillingCycleEnum; bundle_id: SnowflakeId; created_at: string; currency?: string; effective_from: string; effective_to?: string; id: SnowflakeId; updated_at: string }[]>;
    /** Create bundle price */
    createBundlePrice(id: SnowflakeId, body: CreateBundlePriceRequest, _opts?: RequestInit): Promise<{ amount: string; billing_cycle: BillingCycleEnum; bundle_id: SnowflakeId; created_at: string; currency?: string; effective_from: string; effective_to?: string; id: SnowflakeId; updated_at: string }>;
    /** Update bundle status */
    updateBundleStatus(id: SnowflakeId, body: UpdateStatusRequest, _opts?: RequestInit): Promise<void>;
    /** List caller's effective capabilities */
    listEffective(_opts?: RequestInit): Promise<string[]>;
    /** Role capability matrix */
    matrix(_opts?: RequestInit): Promise<Record<string, string[]>>;
    /** List org capabilities */
    listOrg(_opts?: RequestInit): Promise<{ capability: string; created_at: string; credit_cost?: number; grant_type: string; id: SnowflakeId; organization_id: SnowflakeId; quota?: number; quota_window?: string; source: string; updated_at: string }[]>;
    /** List capability overrides */
    listOverrides(_opts?: RequestInit): Promise<{ capability: string; created_at: string; credit_cost?: number; grant_type: string; id: SnowflakeId; organization_id: SnowflakeId; price?: string; quota?: number; quota_window?: string; reason?: string; updated_at: string }[]>;
    /** Create capability override */
    createOverride(body: CreateOverrideRequest, _opts?: RequestInit): Promise<{ capability: string; created_at: string; credit_cost?: number; grant_type: string; id: SnowflakeId; organization_id: SnowflakeId; price?: string; quota?: number; quota_window?: string; reason?: string; updated_at: string }>;
    /** Delete capability override */
    deleteOverride(id: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** List org subscriptions */
    listSubscriptions(params?: { sort?: string; limit?: number; offset?: number }, _opts?: RequestInit): Promise<ListResponse<{ bundle_id: SnowflakeId; created_at: string; current_period_end?: string; current_period_start?: string; id: SnowflakeId; organization_id: SnowflakeId; started_at: string; status: string; updated_at: string }>>;
    /** Subscribe to bundle */
    subscribe(body: SubscribeRequest, _opts?: RequestInit): Promise<{ bundle_id: SnowflakeId; created_at: string; current_period_end?: string; current_period_start?: string; id: SnowflakeId; organization_id: SnowflakeId; started_at: string; status: string; updated_at: string }>;
    /** Update subscription status */
    updateSubscriptionStatus(id: SnowflakeId, body: UpdateStatusRequest, _opts?: RequestInit): Promise<void>;
  };

  const credit: {
    /** Get credit balance */
    getBalance(_opts?: RequestInit): Promise<{ balance: number; organization_id: SnowflakeId }>;
    /** List credit packs */
    listPacks(params?: { view?: View }, _opts?: RequestInit): Promise<{ created_at: string; credits: number; id: SnowflakeId; name: string; price: string; status: string; updated_at: string }[]>;
    /** Create credit pack */
    createPack(body: CreatePackRequest, _opts?: RequestInit): Promise<{ created_at: string; credits: number; id: SnowflakeId; name: string; price: string; status: string; updated_at: string }>;
    /** Update credit pack status */
    updatePackStatus(id: SnowflakeId, body: UpdatePackStatusRequest, _opts?: RequestInit): Promise<void>;
    /** Purchase credit pack */
    purchasePack(body: PurchaseRequest, _opts?: RequestInit): Promise<{ amount: string; created_at: string; credit_pack_id: SnowflakeId; credits_received: number; currency?: string; id: SnowflakeId; organization_id: SnowflakeId; payment_method: string; payment_reference?: string; status: string; updated_at: string }>;
    /** List credit transactions */
    listTransactions(params?: { sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ amount: number; capability?: string; created_at: string; credit_pack_id?: null | SnowflakeId; expires_at?: string; id: SnowflakeId; note?: string; organization_id: SnowflakeId; reference_id?: null | SnowflakeId; type: string }>>;
  };

  const distribution: {
    /** List distribution edges */
    listEdges(params?: { sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ content_id: SnowflakeId; created_at: string; from_organization?: null | OrgSummary; from_organization_id: SnowflakeId; id: SnowflakeId; role: string; to_organization?: null | OrgSummary; to_organization_id: SnowflakeId; updated_at: string }>>;
    /** Create distribution edge */
    createEdge(body: CreateEdgeRequest, _opts?: RequestInit): Promise<{ content_id: SnowflakeId; created_at: string; from_organization_id: SnowflakeId; id: SnowflakeId; role: string; to_organization_id: SnowflakeId; updated_at: string }>;
    /** List distribution edges for content */
    listEdgesForContent(id: SnowflakeId, params?: { view?: View }, _opts?: RequestInit): Promise<{ content_id: SnowflakeId; created_at: string; from_organization?: null | OrgSummary; from_organization_id: SnowflakeId; id: SnowflakeId; role: string; to_organization?: null | OrgSummary; to_organization_id: SnowflakeId; updated_at: string }[]>;
    /** Delete distribution edge */
    deleteEdge(id: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** Create visibility override */
    createOverride(body: OverrideRequest, _opts?: RequestInit): Promise<{ content_id: SnowflakeId; created_at: string; created_by: SnowflakeId; id: SnowflakeId; target_organization_id?: null | SnowflakeId; target_user_id?: null | SnowflakeId; updated_at: string }>;
    /** List overrides for content */
    listOverrides(contentId: SnowflakeId, params?: { view?: View }, _opts?: RequestInit): Promise<{ content_id: SnowflakeId; created_at: string; created_by: SnowflakeId; id: SnowflakeId; target_organization?: null | OrgSummary; target_organization_id?: null | SnowflakeId; target_user_id?: null | SnowflakeId; updated_at: string }[]>;
    /** Delete visibility override */
    deleteOverride(id: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** Reshare content */
    createReshare(body: ReshareRequest, _opts?: RequestInit): Promise<{ content_id: SnowflakeId; created_at: string; id: SnowflakeId; reshared_by: SnowflakeId; reshared_organization_id: SnowflakeId; target_organization_id?: null | SnowflakeId; updated_at: string; visibility: VisibilityEnum }>;
    /** List reshares for content */
    listReshares(contentId: SnowflakeId, params?: { view?: View }, _opts?: RequestInit): Promise<{ content_id: SnowflakeId; created_at: string; id: SnowflakeId; reshared_by: SnowflakeId; reshared_organization?: null | OrgSummary; reshared_organization_id: SnowflakeId; target_organization?: null | OrgSummary; target_organization_id?: null | SnowflakeId; updated_at: string; visibility: VisibilityEnum }[]>;
    /** Delete reshare */
    deleteReshare(id: SnowflakeId, _opts?: RequestInit): Promise<void>;
  };

  const event: {
    /** List events */
    list(params?: { sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; created_by?: null | SnowflakeId; data?: any; event_type?: string; id: SnowflakeId; organization_id: SnowflakeId; status: string; title: string; updated_at: string; visibility: string }>>;
    /** Create event */
    create(body: CreateEventRequest, _opts?: RequestInit): Promise<{ created_at: string; created_by?: null | SnowflakeId; data?: any; event_type?: string; id: SnowflakeId; organization_id: SnowflakeId; status: string; title: string; updated_at: string; visibility: string }>;
    /** Get event */
    get(id: SnowflakeId, params?: { view?: View }, _opts?: RequestInit): Promise<{ created_at: string; created_by?: null | SnowflakeId; data?: any; event_type?: string; id: SnowflakeId; organization_id: SnowflakeId; status: string; title: string; updated_at: string; visibility: string }>;
    /** Update event */
    update(id: SnowflakeId, body: UpdateEventRequest, _opts?: RequestInit): Promise<{ created_at: string; created_by?: null | SnowflakeId; data?: any; event_type?: string; id: SnowflakeId; organization_id: SnowflakeId; status: string; title: string; updated_at: string; visibility: string }>;
    /** Register for event */
    createRegistration(id: SnowflakeId, body: CreateRegistrationRequest, _opts?: RequestInit): Promise<{ created_at: string; data?: any; event_id: SnowflakeId; id: SnowflakeId; invited_by?: null | SnowflakeId; invoice_id?: null | SnowflakeId; payment_window_expires?: string; queue_position?: number; role: string; status: string; updated_at: string; user_id?: null | SnowflakeId }>;
    /** List event sessions */
    listSessions(id: SnowflakeId, params?: { limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; created_by?: null | SnowflakeId; data?: any; event_id?: null | SnowflakeId; id: SnowflakeId; organization_id: SnowflakeId; session_type?: string; sort_order: number; title: string; updated_at: string }>>;
    /** Create event session */
    createSession(id: SnowflakeId, body: CreateSessionRequest, _opts?: RequestInit): Promise<{ created_at: string; created_by?: null | SnowflakeId; data?: any; event_id?: null | SnowflakeId; id: SnowflakeId; organization_id: SnowflakeId; session_type?: string; sort_order: number; title: string; updated_at: string }>;
    /** Delete event session */
    deleteSession(id: SnowflakeId, sessionId: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** Update event status */
    updateStatus(id: SnowflakeId, body: UpdateEventStatusRequest, _opts?: RequestInit): Promise<void>;
    manage: {
      /** List events (management) */
      list(params?: { status?: string; event_type?: string; sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; created_by?: null | SnowflakeId; data?: any; event_type?: string; id: SnowflakeId; organization_id: SnowflakeId; status: string; title: string; updated_at: string; visibility: string }>>;
      /** Delete event registration */
      deleteRegistration(eventId: SnowflakeId, id: SnowflakeId, _opts?: RequestInit): Promise<void>;
      /** Update registration status */
      updateRegistrationStatus(eventId: SnowflakeId, id: SnowflakeId, body: UpdateRegistrationStatusRequest, _opts?: RequestInit): Promise<void>;
      /** Get event (management) */
      get(id: SnowflakeId, params?: { view?: View }, _opts?: RequestInit): Promise<{ created_at: string; created_by?: null | SnowflakeId; data?: any; event_type?: string; id: SnowflakeId; organization_id: SnowflakeId; status: string; title: string; updated_at: string; visibility: string }>;
      /** List registrations */
      listRegistrations(id: SnowflakeId, params?: { sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; data?: any; event_id: SnowflakeId; id: SnowflakeId; invited_by?: null | SnowflakeId; invoice_id?: null | SnowflakeId; payment_window_expires?: string; queue_position?: number; role: string; status: string; updated_at: string; user_id?: null | SnowflakeId }>>;
    };
  };

  const inquiries: {
    /** List inquiries */
    list(params?: { status?: string; content_id?: number; user_id?: number; from_user_id?: number; to_user_id?: number; sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; data: InteractionData; demand_content_id?: null | SnowflakeId; from_user_id?: null | SnowflakeId; id: SnowflakeId; interaction_type: string; organization_id: SnowflakeId; proposed_date?: string; source: string; status: string; supply_content_id?: null | SnowflakeId; to_user_id?: null | SnowflakeId; updated_at: string }>>;
    /** Create an inquiry */
    create(body: CreateInquiryRequest, _opts?: RequestInit): Promise<{ created_at: string; data: InteractionData; demand_content_id?: null | SnowflakeId; from_user_id?: null | SnowflakeId; id: SnowflakeId; interaction_type: string; organization_id: SnowflakeId; proposed_date?: string; source: string; status: string; supply_content_id?: null | SnowflakeId; to_user_id?: null | SnowflakeId; updated_at: string }>;
    /** Submit a public inquiry */
    submit(body: PublicInquiryRequest, _opts?: RequestInit): Promise<any>;
    /** Get inquiry by ID */
    get(id: SnowflakeId, params?: { view?: View }, _opts?: RequestInit): Promise<{ created_at: string; data: InteractionData; demand_content_id?: null | SnowflakeId; from_user_id?: null | SnowflakeId; id: SnowflakeId; interaction_type: string; organization_id: SnowflakeId; proposed_date?: string; source: string; status: string; supply_content_id?: null | SnowflakeId; to_user_id?: null | SnowflakeId; updated_at: string }>;
    /** Delete inquiry */
    delete(id: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** Update inquiry data */
    updateData(id: SnowflakeId, body: UpdateDataRequest, _opts?: RequestInit): Promise<void>;
    /** Update inquiry status */
    updateStatus(id: SnowflakeId, body: UpdateStatusRequest, _opts?: RequestInit): Promise<void>;
  };

  const introspection: {
    /** Get current caller context */
    me(_opts?: RequestInit): Promise<{ capabilities?: string[]; org?: null | OrgStandard; role?: null | RoleEnum; user?: null | MeUser }>;
    /** Update profile */
    updateProfile(body: UpdateProfileRequest, _opts?: RequestInit): Promise<void>;
    /** List content I authored */
    listContent(params?: { content_type?: string; status?: string; category?: string; limit?: number; offset?: number }, _opts?: RequestInit): Promise<ListResponse<{ allow_reshare: boolean; author_id: SnowflakeId; category: string; content_type: string; created_at: string; description?: string; id: SnowflakeId; intended_for?: null | SnowflakeId; organization_id: SnowflakeId; psgc_codes: string[]; side: ContentSideEnum; status: string; subtypes: string[]; title: string; transaction_types?: string[]; updated_at: string; visibility: VisibilityEnum }>>;
    /** List my org memberships */
    listMemberships(params?: { limit?: number; offset?: number }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; id: SnowflakeId; is_personal: boolean; organization_id: SnowflakeId; organization_name: string; organization_slug?: string; role: RoleEnum; status: string; user_id: SnowflakeId }>>;
    /** List my event registrations */
    listRegistrations(params?: { sort?: string; limit?: number; offset?: number }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; data?: any; event_id: SnowflakeId; id: SnowflakeId; invited_by?: null | SnowflakeId; invoice_id?: null | SnowflakeId; payment_window_expires?: string; queue_position?: number; role: string; status: string; updated_at: string; user_id?: null | SnowflakeId }>>;
  };

  const listings: {
    /** Serve media file */
    serveMedia(contentId: number, attachmentId: number, _opts?: RequestInit): Promise<any>;
    /** List listings */
    list(contentType: string, params?: { category?: string; psgc_code?: string; q?: string; visibility?: string; status?: string; author_id?: number; network?: string; transaction_type?: string; subtype?: string; price_min?: number; price_max?: number; sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<ContentHeader & { author?: null | UserSummary; organization?: null | OrgSummary; price?: null | PriceWire }>>;
    /** Create a listing */
    create(contentType: string, body: CreateContentBody, _opts?: RequestInit): Promise<ContentHeader & { attrs?: null | ContentAttrsWire; author?: null | UserSummary; organization?: null | OrgSummary; price?: null | PriceWire }>;
    /** Faceted counts for listings */
    facets(contentType: string, params: { fields: string[]; category?: string; psgc_code?: string; q?: string; visibility?: string; status?: string; author_id?: number; network?: string; transaction_type?: string; subtype?: string; price_min?: number; price_max?: number }, _opts?: RequestInit): Promise<{ facets: Record<string, FacetBucket[]>; total: number }>;
    /** Update media sort order */
    updateMedia(contentType: string, contentId: SnowflakeId, mediaId: SnowflakeId, body: UpdateMediaRequest, _opts?: RequestInit): Promise<void>;
    /** Delete media from listing */
    deleteMedia(contentType: string, contentId: SnowflakeId, mediaId: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** Get listing by ID */
    get(contentType: string, id: SnowflakeId, params?: { view?: View }, _opts?: RequestInit): Promise<ContentHeader & { attrs?: null | ContentAttrsWire; author?: null | UserSummary; organization?: null | OrgSummary; price?: null | PriceWire }>;
    /** Update listing fields */
    update(contentType: string, id: SnowflakeId, body: UpdateContentBody, _opts?: RequestInit): Promise<void>;
    /** Delete listing (soft-delete) */
    delete(contentType: string, id: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** Update listing category-specific attrs (partial) */
    updateAttrs(contentType: string, id: SnowflakeId, body: ContentAttrsWire, _opts?: RequestInit): Promise<void>;
    /** List matches for a listing */
    listMatches(contentType: string, id: SnowflakeId, params?: { limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ content_a_id: SnowflakeId; content_b_id: SnowflakeId; created_at: string; dismissed_by_a?: null | SnowflakeId; dismissed_by_a_at?: string; dismissed_by_b?: null | SnowflakeId; dismissed_by_b_at?: string; factors: any; id: SnowflakeId; org_a?: null | OrgSummary; org_a_id: SnowflakeId; org_b?: null | OrgSummary; org_b_id: SnowflakeId; profile: string; score: number; updated_at: string }>>;
    /** List media for listing */
    listMedia(contentType: string, id: SnowflakeId, _opts?: RequestInit): Promise<{ created_at: string; filename?: string; id: SnowflakeId; label?: string; mime_type: string; role: string; size: number; sort_order: number; url: string }[]>;
    /** Upload media for listing */
    uploadMedia(contentType: string, id: SnowflakeId, body: FormData, _opts?: RequestInit): Promise<{ created_at: string; filename?: string; id: SnowflakeId; label?: string; mime_type: string; role: string; size: number; sort_order: number; url: string }>;
    /** Update listing status */
    updateStatus(contentType: string, id: SnowflakeId, body: UpdateStatusBody, _opts?: RequestInit): Promise<void>;
  };

  const location: {
    /** Search locations */
    search(params?: { q?: string; limit?: number }, _opts?: RequestInit): Promise<{ city_class?: string; city_mun_code?: string; code: string; full_name: string; income_class?: string; level: string; name: string; parent_code?: string; path: string; population?: number; province_code?: string; region_code: string; urban_rural?: string }[]>;
    /** List all regions */
    listRegions(_opts?: RequestInit): Promise<{ city_class?: string; city_mun_code?: string; code: string; full_name: string; income_class?: string; level: string; name: string; parent_code?: string; path: string; population?: number; province_code?: string; region_code: string; urban_rural?: string }[]>;
    /** Get location by PSGC code */
    get(code: string, _opts?: RequestInit): Promise<{ city_class?: string; city_mun_code?: string; code: string; full_name: string; income_class?: string; level: string; name: string; parent_code?: string; path: string; population?: number; province_code?: string; region_code: string; urban_rural?: string }>;
    /** List child areas */
    getChildren(code: string, _opts?: RequestInit): Promise<{ city_class?: string; city_mun_code?: string; code: string; full_name: string; income_class?: string; level: string; name: string; parent_code?: string; path: string; population?: number; province_code?: string; region_code: string; urban_rural?: string }[]>;
  };

  const managedDomain: {
    /** List managed-domain parents */
    list(_opts?: RequestInit): Promise<{ created_at: string; id: SnowflakeId; name: string; status: string; updated_at: string }[]>;
    /** Add a managed-domain parent */
    create(body: CreateManagedDomainRequest, _opts?: RequestInit): Promise<{ created_at: string; id: SnowflakeId; name: string; status: string; updated_at: string }>;
    /** Flip a managed-domain status */
    updateStatus(id: SnowflakeId, body: UpdateManagedDomainRequest, _opts?: RequestInit): Promise<{ created_at: string; id: SnowflakeId; name: string; status: string; updated_at: string }>;
    /** Delete a managed-domain parent */
    delete(id: SnowflakeId, _opts?: RequestInit): Promise<{ deleted: boolean }>;
  };

  const matching: {
    /** List all matches for the org */
    list(params?: { limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ content_a_id: SnowflakeId; content_b_id: SnowflakeId; created_at: string; dismissed_by_a?: null | SnowflakeId; dismissed_by_a_at?: string; dismissed_by_b?: null | SnowflakeId; dismissed_by_b_at?: string; factors: any; id: SnowflakeId; org_a?: null | OrgSummary; org_a_id: SnowflakeId; org_b?: null | OrgSummary; org_b_id: SnowflakeId; profile: string; score: number; updated_at: string }>>;
    /** Dismiss a match */
    dismiss(id: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** Create interaction from match */
    interact(id: SnowflakeId, _opts?: RequestInit): Promise<{ created_at: string; data: InteractionData; demand_content_id?: null | SnowflakeId; from_user_id?: null | SnowflakeId; id: SnowflakeId; interaction_type: string; organization_id: SnowflakeId; proposed_date?: string; source: string; status: string; supply_content_id?: null | SnowflakeId; to_user_id?: null | SnowflakeId; updated_at: string }>;
  };

  const membership: {
    /** List memberships */
    list(params?: { role?: string; status?: string; user_id?: number; source?: string; sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; id: SnowflakeId; invited_by?: null | SnowflakeId; organization_id: SnowflakeId; role: RoleEnum; source?: string; status: string; updated_at: string; user?: null | UserStandard; user_id: SnowflakeId }>>;
    /** Add member */
    add(body: AddMemberRequest, _opts?: RequestInit): Promise<{ created_at: string; data?: any; id: SnowflakeId; invited_by?: null | SnowflakeId; organization_id: SnowflakeId; role: RoleEnum; source: string; status: string; updated_at: string; user_id: SnowflakeId }>;
    /** Get my membership */
    getMine(params?: { view?: View }, _opts?: RequestInit): Promise<{ created_at: string; data?: any; id: SnowflakeId; invited_by?: null | SnowflakeId; organization_id: SnowflakeId; role: RoleEnum; source: string; status: string; updated_at: string; user_id: SnowflakeId }>;
    /** Leave organization */
    deleteMine(_opts?: RequestInit): Promise<void>;
    /** Update membership role */
    updateRole(id: SnowflakeId, body: UpdateMembershipRoleRequest, _opts?: RequestInit): Promise<void>;
    /** Update membership status */
    updateStatus(id: SnowflakeId, body: UpdateMembershipStatusRequest, _opts?: RequestInit): Promise<void>;
  };

  const organization: {
    /** Get organization */
    get(_opts?: RequestInit): Promise<{ accepts_applications: boolean; created_at: string; data?: any; id: SnowflakeId; is_personal: boolean; member_directory: string; name: string; public_invite_token?: string; slug?: string; status: string; updated_at: string }>;
    /** Create organization */
    create(body: CreateOrganizationRequest, _opts?: RequestInit): Promise<{ accepts_applications: boolean; created_at: string; data?: any; id: SnowflakeId; is_personal: boolean; member_directory: string; name: string; public_invite_token?: string; slug?: string; status: string; updated_at: string }>;
    /** Update organization */
    update(body: UpdateOrganizationRequest, _opts?: RequestInit): Promise<{ accepts_applications: boolean; created_at: string; data?: any; id: SnowflakeId; is_personal: boolean; member_directory: string; name: string; public_invite_token?: string; slug?: string; status: string; updated_at: string }>;
    /** List org assets */
    listAssets(_opts?: RequestInit): Promise<{ created_at: string; filename?: string; id: SnowflakeId; label?: string; mime_type: string; role: string; size: number; sort_order: number; url: string }[]>;
    /** Upload org asset */
    uploadAsset(params: { role: string }, body: FormData, _opts?: RequestInit): Promise<{ created_at: string; filename?: string; id: SnowflakeId; label?: string; mime_type: string; role: string; size: number; sort_order: number; url: string }>;
    /** Serve org asset */
    serveAsset(role: string, _opts?: RequestInit): Promise<any>;
    /** Update organization status */
    updateStatus(body: UpdateOrganizationStatusRequest, _opts?: RequestInit): Promise<void>;
  };

  const relationship: {
    /** List org relationships */
    listOrg(params?: { status?: string; type?: string; direction?: string; other_org_id?: number; limit?: number; offset?: number }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; data?: any; expires_at?: string; from_organization_id: SnowflakeId; id: SnowflakeId; started_at?: string; status: string; to_organization_id: SnowflakeId; type: string; updated_at: string }>>;
    /** Create org relationship */
    createOrg(body: CreateOrgRelationshipRequest, _opts?: RequestInit): Promise<{ created_at: string; data?: any; expires_at?: string; from_organization_id: SnowflakeId; id: SnowflakeId; started_at?: string; status: string; to_organization_id: SnowflakeId; type: string; updated_at: string }>;
    /** Update org relationship status */
    updateOrg(id: SnowflakeId, body: UpdateRelationshipStatusRequest, _opts?: RequestInit): Promise<void>;
    /** Delete org relationship */
    deleteOrg(id: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** List user relationships */
    listUser(params?: { status?: string; type?: string; user_id?: number; limit?: number; offset?: number }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; data?: any; expires_at?: string; id: SnowflakeId; organization_id: SnowflakeId; started_at?: string; status: string; type: string; updated_at: string; user_id: SnowflakeId }>>;
    /** Create user relationship */
    createUser(body: CreateUserRelationshipRequest, _opts?: RequestInit): Promise<{ created_at: string; data?: any; expires_at?: string; id: SnowflakeId; organization_id: SnowflakeId; started_at?: string; status: string; type: string; updated_at: string; user_id: SnowflakeId }>;
    /** Update user relationship status */
    updateUser(id: SnowflakeId, body: UpdateRelationshipStatusRequest, _opts?: RequestInit): Promise<void>;
    /** Delete user relationship */
    deleteUser(id: SnowflakeId, _opts?: RequestInit): Promise<void>;
  };

  const requirements: {
    /** Submit a public requirement */
    submit(body: PublicRequirementRequest, _opts?: RequestInit): Promise<any>;
    /** List requirements */
    list(contentType: string, params?: { category?: string; psgc_code?: string; q?: string; visibility?: string; status?: string; author_id?: number; network?: string; transaction_type?: string; subtype?: string; price_min?: number; price_max?: number; sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<ContentHeader & { author?: null | UserSummary; organization?: null | OrgSummary; price?: null | PriceWire }>>;
    /** Create a requirement */
    create(contentType: string, body: CreateContentBody, _opts?: RequestInit): Promise<ContentHeader & { attrs?: null | ContentAttrsWire; author?: null | UserSummary; organization?: null | OrgSummary; price?: null | PriceWire }>;
    /** Faceted counts for requirements */
    facets(contentType: string, params: { fields: string[]; category?: string; psgc_code?: string; q?: string; visibility?: string; status?: string; author_id?: number; network?: string; transaction_type?: string; subtype?: string; price_min?: number; price_max?: number }, _opts?: RequestInit): Promise<{ facets: Record<string, FacetBucket[]>; total: number }>;
    /** Get requirement by ID */
    get(contentType: string, id: SnowflakeId, params?: { view?: View }, _opts?: RequestInit): Promise<ContentHeader & { attrs?: null | ContentAttrsWire; author?: null | UserSummary; organization?: null | OrgSummary; price?: null | PriceWire }>;
    /** Update requirement fields */
    update(contentType: string, id: SnowflakeId, body: UpdateContentBody, _opts?: RequestInit): Promise<void>;
    /** Delete requirement (soft-delete) */
    delete(contentType: string, id: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** Update requirement category-specific attrs (partial) */
    updateAttrs(contentType: string, id: SnowflakeId, body: ContentAttrsWire, _opts?: RequestInit): Promise<void>;
    /** List matches for a requirement */
    listMatches(contentType: string, id: SnowflakeId, params?: { limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ content_a_id: SnowflakeId; content_b_id: SnowflakeId; created_at: string; dismissed_by_a?: null | SnowflakeId; dismissed_by_a_at?: string; dismissed_by_b?: null | SnowflakeId; dismissed_by_b_at?: string; factors: any; id: SnowflakeId; org_a?: null | OrgSummary; org_a_id: SnowflakeId; org_b?: null | OrgSummary; org_b_id: SnowflakeId; profile: string; score: number; updated_at: string }>>;
    /** Update requirement status */
    updateStatus(contentType: string, id: SnowflakeId, body: UpdateStatusBody, _opts?: RequestInit): Promise<void>;
  };

  const reservedSubdomain: {
    /** List reserved subdomain labels */
    list(_opts?: RequestInit): Promise<{ created_at: string; name: string; reason?: string }[]>;
    /** Reserve a subdomain label */
    create(body: CreateReservedSubdomainRequest, _opts?: RequestInit): Promise<{ created_at: string; name: string; reason?: string }>;
    /** Un-reserve a subdomain label */
    delete(name: string, _opts?: RequestInit): Promise<{ deleted: boolean }>;
  };

  const share: {
    /** List share links for content */
    list(contentId: SnowflakeId, _opts?: RequestInit): Promise<{ created_at: string; expires_at?: string; id: SnowflakeId; permissions: string; resource_id: string; resource_type: string; token: string; url: string }[]>;
    /** Create a share link */
    create(contentId: SnowflakeId, body: CreateShareLinkRequest, _opts?: RequestInit): Promise<{ created_at: string; expires_at?: string; id: SnowflakeId; permissions: string; resource_id: string; resource_type: string; token: string; url: string }>;
    /** Revoke a share link */
    delete(contentId: SnowflakeId, shareId: SnowflakeId, _opts?: RequestInit): Promise<void>;
  };

  const site: {
    /** List sites */
    list(params?: { sort?: string; limit?: number; offset?: number; templates?: boolean }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; deploy_ref: string; description?: string; draft_ref: string; forkable: boolean; forked_from_commit?: string; forked_from_id?: null | SnowflakeId; id: SnowflakeId; listed_as_template: boolean; name: string; organization_id: SnowflakeId; repo_path?: string; slug: string; status: string; theme_of?: null | SnowflakeId; updated_at: string; visibility: VisibilityEnum }>>;
    /** Create site */
    create(body: CreateSiteRequest, _opts?: RequestInit): Promise<{ created_at: string; deploy_ref: string; description?: string; draft_ref: string; forkable: boolean; forked_from_commit?: string; forked_from_id?: null | SnowflakeId; id: SnowflakeId; listed_as_template: boolean; name: string; organization_id: SnowflakeId; repo_path?: string; slug: string; status: string; theme_of?: null | SnowflakeId; updated_at: string; visibility: VisibilityEnum }>;
    /** Get site */
    get(id: SnowflakeId, _opts?: RequestInit): Promise<{ created_at: string; deploy_ref: string; description?: string; draft_ref: string; forkable: boolean; forked_from_commit?: string; forked_from_id?: null | SnowflakeId; id: SnowflakeId; listed_as_template: boolean; name: string; organization_id: SnowflakeId; repo_path?: string; slug: string; status: string; theme_of?: null | SnowflakeId; updated_at: string; visibility: VisibilityEnum }>;
    /** Diff deploy vs. draft refs */
    diff(id: SnowflakeId, _opts?: RequestInit): Promise<{ files: DiffFileResponse[]; patch: string }>;
    /** Write one or more files as a single commit */
    writeFiles(id: SnowflakeId, body: WriteFilesRequest, _opts?: RequestInit): Promise<string>;
    /** Read a file from a site repo */
    readFile(id: SnowflakeId, path: string, params?: { ref?: string }, _opts?: RequestInit): Promise<any>;
    /** Delete a file from a site repo */
    deleteFile(id: SnowflakeId, path: string, body: DeleteFileRequest, _opts?: RequestInit): Promise<string>;
    /** List hostnames bound to a site */
    listHostnames(id: SnowflakeId, params?: { limit?: number; offset?: number }, _opts?: RequestInit): Promise<ListResponse<{ cert_status?: string; created_at: string; id: SnowflakeId; is_primary: boolean; name: string; redirect_mode?: string; serves_preview: boolean; site_id: SnowflakeId; status: string; updated_at: string }>>;
    /** Bind a new hostname to a site */
    addHostname(id: SnowflakeId, body: AddHostnameRequest, _opts?: RequestInit): Promise<{ cert_status?: string; created_at: string; id: SnowflakeId; is_primary: boolean; name: string; redirect_mode?: string; serves_preview: boolean; site_id: SnowflakeId; status: string; updated_at: string }>;
    /** Update hostname settings (primary, redirect mode) */
    updateHostname(id: SnowflakeId, hostnameId: SnowflakeId, body: UpdateHostnameRequest, _opts?: RequestInit): Promise<void>;
    /** Remove a hostname from a site */
    removeHostname(id: SnowflakeId, hostnameId: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** Move a hostname to a different site in the same org */
    moveHostname(id: SnowflakeId, hostnameId: SnowflakeId, body: MoveHostnameRequest, _opts?: RequestInit): Promise<{ cert_status?: string; created_at: string; id: SnowflakeId; is_primary: boolean; name: string; redirect_mode?: string; serves_preview: boolean; site_id: SnowflakeId; status: string; updated_at: string }>;
    /** Commit log for a site repo */
    log(id: SnowflakeId, params?: { ref?: string; limit?: number }, _opts?: RequestInit): Promise<{ author: string; date: string; hash: string; message: string }[]>;
    /** Promote a commit or tag onto main */
    promote(id: SnowflakeId, body: PromoteRequest, _opts?: RequestInit): Promise<{ commit: string; created_at: string; message: string; release_number: number; tag: string }>;
    /** List promote history */
    listReleases(id: SnowflakeId, _opts?: RequestInit): Promise<{ commit: string; created_at: string; message: string; release_number: number; tag: string }[]>;
    /** Reset to source */
    resetToSource(id: SnowflakeId, _opts?: RequestInit): Promise<{ created_at: string; deploy_ref: string; description?: string; draft_ref: string; forkable: boolean; forked_from_commit?: string; forked_from_id?: null | SnowflakeId; id: SnowflakeId; listed_as_template: boolean; name: string; organization_id: SnowflakeId; repo_path?: string; slug: string; status: string; theme_of?: null | SnowflakeId; updated_at: string; visibility: VisibilityEnum }>;
    /** Update site status */
    updateStatus(id: SnowflakeId, body: UpdateSiteStatusRequest, _opts?: RequestInit): Promise<void>;
    /** List files in a site repo */
    listTree(id: SnowflakeId, params?: { ref?: string }, _opts?: RequestInit): Promise<{ hash: string; mode: string; obj_type: string; path: string }[]>;
  };

  const status: {
    /** List status history */
    listHistory(entityType: string, entityId: SnowflakeId, _opts?: RequestInit): Promise<{ changed_by?: null | SnowflakeId; created_at: string; entity_id: SnowflakeId; entity_type: string; from_status?: string; id: SnowflakeId; reason?: string; to_status: string }[]>;
    /** List status definitions */
    listDefinitions(entityType: string, _opts?: RequestInit): Promise<{ code: string; created_at: string; entity_type: string; id: SnowflakeId; is_default: boolean; is_terminal: boolean; label: string; sort_order: number; updated_at: string }[]>;
    /** List allowed status transitions */
    listTransitions(entityType: string, params?: { from?: string }, _opts?: RequestInit): Promise<{ created_at: string; entity_type: string; from_status: string; id: SnowflakeId; organization_id?: null | SnowflakeId; to_status: string }[]>;
  };

  const system: {
    /** Health check */
    health(_opts?: RequestInit): Promise<{ status: string }>;
    /** Bootstrap the platform */
    bootstrap(body: BootstrapRequest, _opts?: RequestInit): Promise<{ admin_site: BootstrapSiteOut; api_key: string; org: BootstrapOrgOut; site: BootstrapSiteOut; user: BootstrapUserOut }>;
  };

  const viewings: {
    /** List viewing requests */
    list(params?: { status?: string; content_id?: number; user_id?: number; from_user_id?: number; to_user_id?: number; sort?: string; limit?: number; offset?: number; view?: View }, _opts?: RequestInit): Promise<ListResponse<{ created_at: string; data: InteractionData; demand_content_id?: null | SnowflakeId; from_user_id?: null | SnowflakeId; id: SnowflakeId; interaction_type: string; organization_id: SnowflakeId; proposed_date?: string; source: string; status: string; supply_content_id?: null | SnowflakeId; to_user_id?: null | SnowflakeId; updated_at: string }>>;
    /** Create a viewing request */
    create(body: CreateViewingRequest, _opts?: RequestInit): Promise<{ created_at: string; data: InteractionData; demand_content_id?: null | SnowflakeId; from_user_id?: null | SnowflakeId; id: SnowflakeId; interaction_type: string; organization_id: SnowflakeId; proposed_date?: string; source: string; status: string; supply_content_id?: null | SnowflakeId; to_user_id?: null | SnowflakeId; updated_at: string }>;
    /** Get viewing request by ID */
    get(id: SnowflakeId, params?: { view?: View }, _opts?: RequestInit): Promise<{ created_at: string; data: InteractionData; demand_content_id?: null | SnowflakeId; from_user_id?: null | SnowflakeId; id: SnowflakeId; interaction_type: string; organization_id: SnowflakeId; proposed_date?: string; source: string; status: string; supply_content_id?: null | SnowflakeId; to_user_id?: null | SnowflakeId; updated_at: string }>;
    /** Delete viewing request */
    delete(id: SnowflakeId, _opts?: RequestInit): Promise<void>;
    /** Update viewing request data */
    updateData(id: SnowflakeId, body: UpdateDataRequest, _opts?: RequestInit): Promise<void>;
    /** Update viewing request status */
    updateStatus(id: SnowflakeId, body: UpdateStatusRequest, _opts?: RequestInit): Promise<void>;
  };

const session: {
    start(tokens: { access_token: string; refresh_token: string }): void;
    clear(): void;
    active(): boolean;
    onExpired(callback: () => void): void;
  };
}
