IMPORTANT: These are detailed instructions that you MUST read carefully and follow exactly. Every rule, constraint, format requirement, and example below exists for a reason. Do NOT skip sections, do NOT invent your own conventions, and do NOT deviate from the specified output format. If a rule says "MUST" or "NEVER", treat it as absolute.


You are helping create an AIMEAT service. AIMEAT is an AI agent infrastructure protocol.

Available building blocks:
- CSM (Community Service Manifest): YAML defining data schemas, fields, consent rules, validation.
- MSM (Micro Service Manifest): YAML defining external API integrations, auth, endpoints.
- Extension: V8-sandboxed JavaScript logic with YAML manifest. Actions get ctx object with memory, wallet, consent, trust, fetch APIs.
- App: HTML/JS user interface published to the apps catalog.
- Memory: Key-value storage with namespace isolation.
- Translation: Per-locale i18n strings.
- Cortex: Client-side JS domain library (IIFE on AIMEAT namespace). Wraps extension APIs and memory reads into clean domain methods for apps.

Extensions run in an ISOLATED V8 sandbox with ONLY this API (no Node.js, no global fetch, no setTimeout, no require, no import):
  ctx.memory.get(key) → value or null (ALWAYS null-check before using: 

Create a CSM (Community Service Manifest) YAML for: PRH Yritystietopalvelu – palvelumäärittely

Project: Joka hakee yrityksen tiedot PRH:lta avoimesta APIsta ja voin laittaa seurantaan sen. Käytä testaukseen "Overscale Solutions" yritystä API hauissa.

Blueprint components: csm-1 (csm: PRH Yritystietopalvelu – palvelumäärittely), memory-1 (memory: Oletusasetukset), translation-1 (translation: Käännökset (fi)), translation-2 (translation: Käännökset (en)), ext-1 (extension: PRH API -integraatio), cortex-data (cortex: PRH-yritystietojen tietokerros), cortex-feature-search (cortex: Yrityshaku), cortex-feature-detail (cortex: Yrityskortti), cortex-feature-watchlist (cortex: Seurantalista), cortex-feature-changes (cortex: Muutoshistoria), cortex-feature-comparison (cortex: Yritysvertailu), cortex-feature-settings (cortex: Asetukset), cortex-app (cortex: PRH Yritystietopalvelu – sovelluskehys), app-1 (app: PRH Yritystietopalvelu)

## Domain Data Model (EXACT schemas — follow these precisely)
These are the memory key schemas for this component. Use these exact key names and data shapes.

```json
{
  "structures": {
    "Company": {
      "type": "object",
      "description": "PRH YTJ v3 API:n palauttama yrityksen perustiedot",
      "properties": {
        "businessId": {
          "type": "object",
          "properties": {
            "value": {
              "type": "string",
              "description": "Y-tunnus (esim. 3323553-5)"
            },
            "registrationDate": {
              "type": "string"
            },
            "source": {
              "type": "string"
            }
          }
        },
        "euId": {
          "type": "object",
          "properties": {
            "value": {
              "type": "string"
            },
            "source": {
              "type": "string"
            }
          }
        },
        "names": {
          "type": "array",
          "items": {
            "$ref": "CompanyName"
          }
        },
        "mainBusinessLine": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "description": "TOL-koodi"
            },
            "descriptions": {
              "type": "array",
              "items": {
                "$ref": "LocalizedDescription"
              }
            },
            "typeCodeSet": {
              "type": "string"
            },
            "registrationDate": {
              "type": "string"
            },
            "source": {
              "type": "string"
            }
          }
        },
        "website": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string"
            },
            "registrationDate": {
              "type": "string"
            },
            "source": {
              "type": "string"
            }
          }
        },
        "companyForms": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "descriptions": {
                "type": "array",
                "items": {
                  "$ref": "LocalizedDescription"
                }
              },
              "registrationDate": {
                "type": "string"
              },
              "version": {
                "type": "number"
              },
              "source": {
                "type": "string"
              }
            }
          }
        },
        "companySituations": {
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "registeredEntries": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "descriptions": {
                "type": "array",
                "items": {
                  "$ref": "LocalizedDescription"
                }
              },
              "registrationDate": {
                "type": "string"
              },
              "register": {
                "type": "string"
              },
              "authority": {
                "type": "string"
              }
            }
          }
        },
        "addresses": {
          "type": "array",
          "items": {
            "$ref": "CompanyAddress"
          }
        },
        "tradeRegisterStatus": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "registrationDate": {
          "type": "string"
        },
        "lastModified": {
          "type": "string",
          "description": "ISO 8601"
        }
      }
    },
    "CompanyName": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "description": "1=toiminimi, 2=rinnakkaistoiminimi, 3=aputoiminimi"
        },
        "registrationDate": {
          "type": "string"
        },
        "version": {
          "type": "number"
        },
        "source": {
          "type": "string"
        }
      }
    },
    "LocalizedDescription": {
      "type": "object",
      "properties": {
        "languageCode": {
          "type": "string",
          "description": "1=suomi, 2=ruotsi, 3=englanti"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "CompanyAddress": {
      "type": "object",
      "properties": {
        "type": {
          "type": "number",
          "description": "1=postiosoite, 2=käyntiosoite"
        },
        "street": {
          "type": "string"
        },
        "buildingNumber": {
          "type": "string"
        },
        "entrance": {
          "type": "string"
        },
        "apartmentNumber": {
          "type": "string"
        },
        "apartmentIdSuffix": {
          "type": "string"
        },
        "co": {
          "type": "string"
        },
        "postCode": {
          "type": "string"
        },
        "postOffices": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "city": {
                "type": "string"
              },
              "languageCode": {
                "type": "string"
              },
              "municipalityCode": {
                "type": "string"
              }
            }
          }
        },
        "postOfficeBox": {
          "type": "string"
        },
        "registrationDate": {
          "type": "string"
        },
        "source": {
          "type": "string"
        }
      }
    },
    "CompanySearchResult": {
      "type": "object",
      "properties": {
        "totalResults": {
          "type": "number"
        },
        "companies": {
          "type": "array",
          "items": {
            "$ref": "Company"
          }
        }
      }
    },
    "WatchlistItem": {
      "type": "object",
      "properties": {
        "businessId": {
          "type": "string"
        },
        "companyName": {
          "type": "string"
        },
        "addedAt": {
          "type": "string",
          "description": "ISO 8601"
        },
        "lastChecked": {
          "type": "string",
          "description": "ISO 8601"
        },
        "lastSnapshot": {
          "$ref": "Company"
        }
      }
    },
    "Change": {
      "type": "object",
      "properties": {
        "businessId": {
          "type": "string"
        },
        "companyName": {
          "type": "string"
        },
        "field": {
          "type": "string"
        },
        "oldValue": {
          "type": "object"
        },
        "newValue": {
          "type": "object"
        },
        "detectedAt": {
          "type": "string",
          "description": "ISO 8601"
        },
        "notified": {
          "type": "boolean"
        }
      }
    },
    "Comparison": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "businessIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "createdAt": {
          "type": "string",
          "description": "ISO 8601"
        }
      }
    },
    "SettingsConfig": {
      "type": "object",
      "properties": {
        "defaultLanguage": {
          "type": "string",
          "enum": [
            "fi",
            "sv",
            "en"
          ],
          "description": "Hakutulosten kieli"
        },
        "notificationsEnabled": {
          "type": "boolean",
          "description": "Push-ilmoitukset muutoksista"
        }
      }
    }
  },
  "memoryKeys": {
    "settings.config": {
      "type": "object",
      "schema": {
        "$ref": "SettingsConfig"
      },
      "source": "config",
      "producedBy": "memory-1",
      "consumedBy": [
        "ext-1",
        "cortex-data"
      ]
    },
    "i18n.fi": {
      "type": "object",
      "source": "static",
      "producedBy": "translation-1",
      "consumedBy": [
        "cortex-app"
      ]
    },
    "i18n.en": {
      "type": "object",
      "source": "static",
      "producedBy": "translation-2",
      "consumedBy": [
        "cortex-app"
      ]
    },
    "watchlist.items": {
      "type": "object",
      "description": "Objekti avaimena Y-tunnus, arvona WatchlistItem",
      "additionalProperties": {
        "$ref": "WatchlistItem"
      },
      "source": "computed",
      "producedBy": "ext-1",
      "consumedBy": [
        "cortex-data"
      ]
    },
    "changes.log": {
      "type": "array",
      "items": {
        "$ref": "Change"
      },
      "source": "computed",
      "producedBy": "ext-1",
      "consumedBy": [
        "cortex-data"
      ]
    },
    "comparisons.saved": {
      "type": "array",
      "items": {
        "$ref": "Comparison"
      },
      "source": "computed",
      "producedBy": "cortex-data",
      "consumedBy": [
        "cortex-data"
      ]
    }
  },
  "actions": {
    "ext:search": {
      "input": {
        "query": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "name",
            "businessId"
          ],
          "description": "Hakutyyppi"
        }
      },
      "output": {
        "$ref": "CompanySearchResult"
      }
    },
    "ext:getCompany": {
      "input": {
        "businessId": {
          "type": "string"
        }
      },
      "output": {
        "$ref": "Company"
      }
    },
    "ext:addToWatchlist": {
      "input": {
        "businessId": {
          "type": "string"
        },
        "companyName": {
          "type": "string"
        }
      },
      "output": {
        "$ref": "WatchlistItem"
      }
    },
    "ext:checkChanges": {
      "input": {},
      "output": {
        "type": "object",
        "properties": {
          "checked": {
            "type": "number"
          },
          "changesFound": {
            "type": "number"
          }
        }
      }
    },
    "ext:init": {
      "input": {},
      "output": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          }
        }
      }
    },
    "cortex:searchCompanies": {
      "input": {
        "query": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "output": {
        "$ref": "CompanySearchResult"
      }
    },
    "cortex:getCompany": {
      "input": {
        "businessId": {
          "type": "string"
        }
      },
      "output": {
        "$ref": "Company"
      }
    },
    "cortex:getWatchlist": {
      "input": {},
      "output": {
        "type": "array",
        "items": {
          "$ref": "WatchlistItem"
        }
      }
    },
    "cortex:addToWatchlist": {
      "input": {
        "businessId": {
          "type": "string"
        },
        "companyName": {
          "type": "string"
        }
      },
      "output": {
        "$ref": "WatchlistItem"
      }
    },
    "cortex:removeFromWatchlist": {
      "input": {
        "businessId": {
          "type": "string"
        }
      },
      "output": {
        "type": "object",
        "properties": {
          "removed": {
            "type": "boolean"
          }
        }
      }
    },
    "cortex:getChanges": {
      "input": {
        "businessId": {
          "type": "string"
        }
      },
      "output": {
        "type": "array",
        "items": {
          "$ref": "Change"
        }
      }
    },
    "cortex:getComparisons": {
      "input": {},
      "output": {
        "type": "array",
        "items": {
          "$ref": "Comparison"
        }
      }
    },
    "cortex:saveComparison": {
      "input": {
        "$ref": "Comparison"
      },
      "output": {
        "$ref": "Comparison"
      }
    },
    "cortex:removeComparison": {
      "input": {
        "id": {
          "type": "string"
        }
      },
      "output": {
        "type": "object",
        "properties": {
          "removed": {
            "type": "boolean"
          }
        }
      }
    }
  }
}
```


## LANGUAGE

The user works in "fi". Write all human-readable text (labels, descriptions, comments, UI strings, variable names for display) in that language.
Code identifiers, JSON keys, YAML keys, and API names stay in English.


## YAML STRING RULES (read this FIRST — violations cause parse errors)

Every string value MUST be on ONE line wrapped in double quotes. No exceptions.
NEVER use > or | (block scalars). NEVER leave strings unquoted.

WRONG — will crash the parser:
  description: > This is a multi-line folded string
  description: This has (parens) and special: chars
  description: |
    This is a literal block

CORRECT — always do this:
  description: "This has (parens) and special: chars all on one line"

## Structure

Return ONLY valid YAML in a yaml code block. Copy this structure EXACTLY:
```yaml
csm: "1.0"
service:
  name: kebab-case-name
  type: directory
  description: "What this service does — keep on ONE line in double quotes"
  version: "1.0"
schema_mode: open
data_schema:
  required:
    fieldName:
      type: string
    anotherField:
      type: number
  optional:
    optionalField:
      type: string
      enum: [value1, value2]
consent_requirements:
  visibility_default: public
  requires_consent: false
  consent_purpose: "Why consent is needed"
  data_retention: "365_days"
moderation:
  flags_enabled: true
  auto_hide_threshold: 5
  appeals_enabled: false
ui_hints:
  list_view: [fieldName, anotherField]
  detail_view: [fieldName, anotherField, optionalField]
  search_fields: [fieldName]
```

## Additional rules
- data_schema.required and data_schema.optional are MAPS (fieldName: {type: ...}), NOT arrays (- name: ...)
- data_schema.required MUST have at least one field
- Field types: string, number, integer, boolean, array, object
- All date/time fields MUST be type: string with description mentioning ISO 8601 format
- service.name: concise kebab-case identifier, 1-3 words. Use the project's own name when it has one. Do NOT invent generic abbreviations or add redundant suffixes like "-service" or "-monitor".
- ONLY include fields that exist in the raw source data. Computed/derived values (aggregates, scores, trends, risk levels, statistics) are calculated by extensions and stored in separate memory keys — they do NOT belong in the CSM data_schema.
- Avoid redundant fields. If the source provides a unique identifier (e.g. guid), do not add a second id field. If a value is always the same (e.g. single data source), do not include it as a field.