# Simple Scrape -> Title -> Description config.
#
# Run via the UI: pick your SKU column as "main product identifier",
# your product-name column as "title", and your description column as
# "description". The UI will populate fieldMapping for mpn/title/description.
# Make sure your CSV has a `domain` column (or add it as an extra column).

apiConfig:
  generationEndpoints:
    - "generate_title"
    - "generate_description"
    - "extract_attributes"

  researchStepEndpoints:
    - endpoints: [universal_search]
      strategy: standalone

  universal_search:
    searchSteps:
      - query: "site:{domain} {mpn} {title}"
        useFields:
          domain: "domain"
          mpn: "mpn"
          title: "title"

      - query: "{mpn} {title}"
        useFields:
          mpn: "mpn"
          title: "title"

    stopOnFirstSuccess: true

    scrapers:
      - type: smart_scraper
        name: product_data
        prompt: >
          For the product: {product_name} (MPN: {mpn}), extract the title,
          full description, and key attribute/spec key-value pairs from the
          page.
        maxResults: 3

  generate_title:
    rules:
      - "Lead with the main keyword."
      - "Include Color in the title"
      - "Avoid all-caps and promotional language."
      - "Includes keywords at the end that help explain product features"
    examples:
      - "Nike Men's Dri-FIT Short-Sleeve Black Top"
      - "{brand} Tall Fescue Grass Sun or Shade Fertilizer/Seed/Soil Improver {keywords}"
    max_characters: 60
    min_characters: 10

  extract_attributes:
    additionalResearchFields:
      - product_data
    rules:
      - "Extract ONLY attributes for this specific product, not category-wide attributes or attributes belonging to related products on the page."
      - "Use the scraped product data as the source of truth. Do not invent attribute values."
      - "Return attribute names exactly as they appear on the source page (do not normalize or rename)."
      - "Skip attributes whose values are NA, null, empty, or boilerplate (e.g., 'See website', 'Contact us')."

  generate_description:
    rules:
      - "Open with the product's primary benefit."
      - "Cover key features and typical use cases."
      - "Close with a short call to action."
    examples:
      - "Experience all-day comfort with this adjustable ergonomic office chair — built for long work sessions and easy to dial in to your fit. Order yours today."
      - "Take your music anywhere with our portable Bluetooth speaker. Up to 12 hours of playback, water-resistant build, and one-touch pairing. Hit play wherever you go."
    max_characters: 1000
    min_characters: 100
