openapi: "3.0.3"
info:
  title: "Subscription billing fixture"
  version: "1.0.0"
  description: "The plan code is a natural key, so the generator has to reuse it rather than mint an id. The price constraint is non-negative, which rules out a negative price row. The three-member status enum is the same in both tools, so it is not a differentiator and the comparison says so. The renews_at timestamp has to be written in a format Postgres parses without an explicit cast."
paths: {}
x-domain-id: "cmp_billing"
x-dialect: "postgres"
components:
  schemas:
    plans:
      type: "object"
      x-primary-key: "code"
      required: ["code", "price_cents", "interval"]
      properties:
        code:
          type: "string"
        price_cents:
          type: "integer"
          minimum: 0
        interval:
          type: "string"
          enum: ["month", "year"]
    subscriptions:
      type: "object"
      x-primary-key: "id"
      required: ["id", "plan_code", "status", "renews_at"]
      properties:
        id:
          type: "string"
          format: "uuid"
        plan_code:
          $ref: "#/components/schemas/plans"
        status:
          type: "string"
          enum: ["trialing", "active", "past_due"]
        renews_at:
          type: "string"
          format: "date-time"
