{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/foundryims-com/json-schema/foundryims-com-storefront-variant-resolved-dto-schema.json",
  "title": "StorefrontVariantResolvedDto",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/foundryims-com-openapi.json#/components/schemas/StorefrontVariantResolvedDto",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "sku": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "price": {
      "type": "number",
      "description": "What the buyer pays now — the sale price while a sale is on."
    },
    "regularPrice": {
      "type": "number",
      "description": "The regular price; equals price when not on sale."
    },
    "onSale": {
      "type": "boolean",
      "description": "True while a sale window is open on this listing."
    },
    "saleEndsAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "ISO timestamp the sale ends, when one is set."
    },
    "compareAtPrice": {
      "type": [
        "number",
        "null"
      ],
      "description": "\"Was\"/MSRP price. While on sale this is the regular price."
    },
    "map": {
      "type": [
        "number",
        "null"
      ],
      "description": "Minimum advertised price."
    },
    "upc": {
      "type": [
        "string",
        "null"
      ]
    },
    "gtin": {
      "type": [
        "string",
        "null"
      ]
    },
    "mpn": {
      "type": [
        "string",
        "null"
      ]
    },
    "weight": {
      "type": [
        "number",
        "null"
      ]
    },
    "inStock": {
      "type": "boolean"
    },
    "availableQuantity": {
      "type": "number"
    },
    "optionValues": {
      "description": "One value per option: the variant's primary. Use optionValueSets to see every value a family child answers.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/OptionValueDto"
      }
    },
    "optionValueSets": {
      "description": "Every value per option, primary first. A family child may answer several choices on one option (e.g. a part that fits several year ranges); it matches a customer's answers when each answer is in that option's values.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/OptionValueSetDto"
      }
    },
    "images": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ImageRefDto"
      }
    },
    "customFields": {
      "description": "This variant's effective custom fields (variant value overrides product).",
      "type": "array",
      "items": {
        "$ref": "#/$defs/StorefrontCustomFieldDto"
      }
    },
    "currency": {
      "type": "string"
    },
    "product": {
      "$ref": "#/$defs/IdNameDto"
    }
  },
  "required": [
    "id",
    "sku",
    "name",
    "price",
    "regularPrice",
    "onSale",
    "saleEndsAt",
    "compareAtPrice",
    "map",
    "upc",
    "gtin",
    "mpn",
    "weight",
    "inStock",
    "availableQuantity",
    "optionValues",
    "optionValueSets",
    "images",
    "customFields",
    "currency",
    "product"
  ],
  "$defs": {
    "IdNameDto": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ]
    },
    "ImageRefDto": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        }
      },
      "required": [
        "url"
      ]
    },
    "OptionValueDto": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "value"
      ]
    },
    "OptionValueSetDto": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "name",
        "values"
      ]
    },
    "StorefrontCustomFieldDto": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "description": "Stable machine key."
        },
        "label": {
          "type": "string"
        },
        "value": {
          "type": "object",
          "description": "Typed value (string | number | boolean | array | object)."
        },
        "unit": {
          "type": "string",
          "description": "Display unit (NUMBER fields), omitted when unset."
        },
        "type": {
          "type": "string",
          "enum": [
            "text",
            "number",
            "boolean",
            "enum",
            "date",
            "url",
            "json"
          ]
        },
        "group": {
          "type": "string",
          "description": "Spec-table section, omitted when ungrouped."
        },
        "displayOrder": {
          "type": "number",
          "description": "Sort order within the spec table."
        }
      },
      "required": [
        "key",
        "label",
        "value",
        "type",
        "displayOrder"
      ]
    }
  }
}