Source code for cadrumo.core.config_integration_fields
"""Google, workbook-parity, and financial-ingest settings.Split from :mod:`~core.config` to keep the central settings facade within theline budget. :class:`~core.config.Settings` inherits these fields with theirdeclared validation and defaults. Product-owned fields derive ``CADRUMO_*``environment names; authority-owned integration fields retain explicit``AEAT_*`` names.See Also: :class:`~core.config.Settings` Central environment facade that inherits this mixin and normalizes its path fields. :func:`~core.config.load_settings` Runtime entry point used by integration consumers to read these fields. :mod:`~adapters.outbound.storage.factory` Outbound storage factory that consumes the Google Drive vault defaults. :mod:`~adapters.inbound.financial.providers.csv` CSV financial-ingest provider that reads the default CSV encoding."""from__future__importannotationsfrompathlibimportPathfromtypingimportFinalfrompydanticimportField,field_validatorfrom..core.errors.hierarchyimportpydantic_validation_boundaryfrom.config_runtime_fieldsimportCadrumoRuntimeSettingsfrom.external_constantsimportDEFAULT_CURRENCYFORMER_PRODUCT_GOOGLE_DRIVE_VAULT_FOLDER_NAME:Final="aeat-vault"
[docs]classCadrumoIntegrationSettings(CadrumoRuntimeSettings):"""Settings for external integration defaults and local financial stores."""# ── Google integration ───────────────────────────────────────────────cadrumo_google_drive_vault_folder_name:str=Field(default="cadrumo-vault",min_length=1,description="Folder name created under the Google Drive root for the Cadrumo vault",)cadrumo_google_oauth_access_refresh_buffer_s:int=Field(default=300,gt=0,description="Clock-skew buffer (seconds) before nominal expiry when refreshing Google access tokens",)@field_validator("cadrumo_google_drive_vault_folder_name")@classmethod@pydantic_validation_boundarydef_refuse_former_product_google_drive_vault_folder(cls,value:str)->str:ifvalue.strip().casefold()==FORMER_PRODUCT_GOOGLE_DRIVE_VAULT_FOLDER_NAME:raiseValueError("the former product Google Drive vault folder is not supported")returnvalue# ── Sheets ───────────────────────────────────────────────────────────cadrumo_calc_sheets_recalc_delay_s:float=Field(default=2.0,gt=0,description="Delay (seconds) waiting for Google Sheets server-side recalculation between parity polls",)# ── Financial ingest ───────────────────────────────────────────────────financial_base_currency:str=Field(default=DEFAULT_CURRENCY,description="Fallback ISO 4217 currency used when a financial source omits a per-row currency",)financial_default_csv_encoding:str=Field(default="utf-8",description="Preferred encoding attempted first when decoding financial CSV sources",)cadrumo_financial_txs_dir:Path=Field(default=Path("financial")/"transactions",description="Directory where the transaction catalogue JSON file is stored",)cadrumo_invoices_dir:Path=Field(default=Path("financial")/"invoices",description="Directory where the invoice catalogue JSON file is stored",)cadrumo_attachments_dir:Path=Field(default=Path("financial")/"attachments",description="Root directory for the attachment byte and manifest store",)cadrumo_usage_ratios_path:Path=Field(default=Path("financial")/"usage-ratios.json",description="User-configured per-category usage ratio overrides",)