"""Logic for generating the bulk split ingestion template.""" from collaborator.models.snowflake.product_persister import ProductPersister from collaborator.schemas.split import BulkIngestTemplateRowSchema def get_bulk_ingest_template(vendor_id: int) -> list[BulkIngestTemplateRowSchema]: """Build the template for a vendor: all tracks with empty split fields. Each track produces one row with split fields set to None, ready for the user to fill in. Existing splits are intentionally excluded. Args: vendor_id: The vendor whose catalog to export. Returns: List of BulkIngestTemplateRowSchema, ordered by product_id then tuid. """ track_rows = ProductPersister.get_tracks_for_template(vendor_id) if not track_rows: return [] return [ BulkIngestTemplateRowSchema( vendor_id=vendor_id, product_id=product_id, product_upc=product_upc, product_title=product_title, tuid=tuid, track_name=track_name, track_isrc=isrc, ) for product_id, product_upc, product_title, tuid, track_name, isrc in track_rows ]