{
  "openapi": "3.1.0",
  "info": {
    "title": "ReBattery Supplier API",
    "version": "1.0.0",
    "description": "Private, account-scoped API for approved suppliers to create and manage battery listings.",
    "license": {
      "name": "Proprietary",
      "identifier": "LicenseRef-Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://www.rebattery.io/api/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Listings",
      "description": "Create and manage inventory owned by the authenticated supplier account."
    }
  ],
  "paths": {
    "/listings": {
      "get": {
        "tags": ["Listings"],
        "summary": "List owned listings",
        "operationId": "listListings",
        "x-required-scope": "listings:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Newest owned listings first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListingCollection"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/RetryableError"
          }
        }
      },
      "post": {
        "tags": ["Listings"],
        "summary": "Create a listing",
        "operationId": "createListing",
        "x-required-scope": "listings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateListingInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Draft created with a non-fatal image ingestion error",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateListingAcknowledgement"
                }
              }
            }
          },
          "201": {
            "description": "Listing created",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateListingAcknowledgement"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "425": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/RetryableError"
          }
        }
      }
    },
    "/listings/{listingId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ListingId"
        }
      ],
      "get": {
        "tags": ["Listings"],
        "summary": "Read one owned listing",
        "operationId": "getListing",
        "x-required-scope": "listings:read or listings:write",
        "responses": {
          "200": {
            "description": "Complete editable listing resource",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListingResource"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/RetryableError"
          }
        }
      },
      "patch": {
        "tags": ["Listings"],
        "summary": "Apply a sparse listing edit",
        "operationId": "patchListing",
        "x-required-scope": "listings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchListingInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MutationAcknowledged"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "412": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "425": {
            "$ref": "#/components/responses/Error"
          },
          "428": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/RetryableError"
          }
        }
      }
    },
    "/listings/{listingId}/images": {
      "post": {
        "tags": ["Listings"],
        "summary": "Append listing images",
        "operationId": "appendListingImages",
        "x-required-scope": "listings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/ListingId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["images"],
                "properties": {
                  "images": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "$ref": "#/components/schemas/ImageInput"
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Images appended",
            "headers": {
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageMutationAcknowledgement"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "412": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "425": {
            "$ref": "#/components/responses/Error"
          },
          "428": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/RetryableError"
          }
        }
      }
    },
    "/listings/{listingId}/publish": {
      "$ref": "#/components/pathItems/PublishAction"
    },
    "/listings/{listingId}/withdraw": {
      "$ref": "#/components/pathItems/WithdrawAction"
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Supplier API key with the scope required by the operation."
      }
    },
    "parameters": {
      "ListingId": {
        "name": "listingId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Unique key for this exact mutation intent. Retained for 24 hours.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "IfMatch": {
        "name": "If-Match",
        "in": "header",
        "required": true,
        "description": "Quoted numeric ETag returned by the latest ID read or mutation.",
        "schema": {
          "type": "string",
          "pattern": "^\"[1-9][0-9]*\"$",
          "examples": ["\"12\""]
        }
      }
    },
    "headers": {
      "ETag": {
        "description": "Quoted numeric listing revision.",
        "schema": {
          "type": "string",
          "examples": ["\"12\""]
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "pathItems": {
      "PublishAction": {
        "post": {
        "tags": ["Listings"],
        "summary": "Publish a listing",
        "operationId": "publishListing",
        "x-required-scope": "listings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/ListingId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/LifecycleAcknowledged"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "412": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "425": {
            "$ref": "#/components/responses/Error"
          },
          "428": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/RetryableError"
          }
        }
        }
      },
      "WithdrawAction": {
        "post": {
        "tags": ["Listings"],
        "summary": "Withdraw a listing",
        "operationId": "withdrawListing",
        "x-required-scope": "listings:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/ListingId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/IfMatch"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/LifecycleAcknowledged"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "412": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "425": {
            "$ref": "#/components/responses/Error"
          },
          "428": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/RetryableError"
          }
        }
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Request failed",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ValidationError": {
        "description": "Validation or publication readiness failed",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ValidationError"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RetryableError": {
        "description": "Service temporarily unavailable",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "MutationAcknowledged": {
        "description": "Mutation committed",
        "headers": {
          "ETag": {
            "$ref": "#/components/headers/ETag"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MutationAcknowledgement"
            }
          }
        }
      },
      "LifecycleAcknowledged": {
        "description": "Lifecycle action committed or completed as a no-op",
        "headers": {
          "ETag": {
            "$ref": "#/components/headers/ETag"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/LifecycleAcknowledgement"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "ValidationError": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          },
          {
            "type": "object",
            "properties": {
              "field_errors": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "listing_id": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "const": "draft"
              }
            }
          }
        ]
      },
      "MutationAcknowledgement": {
        "type": "object",
        "required": ["id", "revision"],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "LifecycleAcknowledgement": {
        "allOf": [
          {
            "$ref": "#/components/schemas/MutationAcknowledgement"
          },
          {
            "type": "object",
            "required": ["status"],
            "properties": {
              "status": {
                "type": "string",
                "enum": ["published", "withdrawn"]
              }
            }
          }
        ]
      },
      "ImageMutationAcknowledgement": {
        "allOf": [
          {
            "$ref": "#/components/schemas/MutationAcknowledgement"
          },
          {
            "type": "object",
            "required": ["imagesAdded"],
            "properties": {
              "imagesAdded": {
                "type": "integer",
                "minimum": 0,
                "maximum": 10
              }
            }
          }
        ]
      },
      "CreateListingAcknowledgement": {
        "type": "object",
        "required": ["id", "slug", "status", "revision"],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "reference": {
            "type": ["string", "null"]
          },
          "slug": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["draft", "published"]
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "images_added": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "image_error": {
            "type": "string"
          },
          "evidence_capture": {
            "type": "string",
            "const": "failed",
            "description": "The listing mutation succeeded, but publication evidence capture requires operator reconciliation."
          }
        },
        "additionalProperties": false
      },
      "ListingCollection": {
        "type": "object",
        "required": ["listings", "pagination"],
        "properties": {
          "listings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ListingSummary"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          }
        },
        "additionalProperties": false
      },
      "ListingSummary": {
        "type": "object",
        "required": ["id", "slug", "status", "imageCount", "revision"],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "reference": {
            "type": ["string", "null"]
          },
          "slug": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["draft", "published", "withdrawn", "completed"]
          },
          "imageCount": {
            "type": "integer",
            "minimum": 0
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          }
        },
        "additionalProperties": false
      },
      "Pagination": {
        "type": "object",
        "required": ["limit", "offset", "total", "nextOffset"],
        "properties": {
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "offset": {
            "type": "integer",
            "minimum": 0
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "nextOffset": {
            "type": ["integer", "null"],
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "ListingResource": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EditableListingFields"
          },
          {
            "type": "object",
            "required": ["id", "title", "slug", "status", "quantityAvailable", "imageCount", "images", "revision", "createdAt", "updatedAt"],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "title": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": ["draft", "published", "withdrawn", "completed"]
              },
              "quantityAvailable": {
                "type": ["integer", "null"],
                "minimum": 0
              },
              "imageCount": {
                "type": "integer",
                "minimum": 0
              },
              "images": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ListingImage"
                }
              },
              "revision": {
                "type": "integer",
                "minimum": 1
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "CreateListingInput": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CreateEditableListingFields"
          },
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": ["draft", "published"],
                "default": "draft"
              },
              "images": {
                "type": "array",
                "maxItems": 10,
                "items": {
                  "$ref": "#/components/schemas/ImageInput"
                }
              }
            }
          }
        ],
        "unevaluatedProperties": false
      },
      "CreateEditableListingFields": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EditableListingFields"
          },
          {
            "type": "object",
            "properties": {
              "buyItNowPrice": {
                "$ref": "#/components/schemas/PositiveMoney"
              },
              "minimumOfferPrice": {
                "$ref": "#/components/schemas/PositiveMoney"
              },
              "currency": {
                "type": "string",
                "enum": ["GBP", "EUR", "USD"]
              },
              "reference": { "type": "string" },
              "description": { "type": "string" },
              "manufacturer": { "type": "string" },
              "model": { "type": "string" },
              "chemistry": { "type": "string" },
              "format": {
                "type": "string",
                "enum": ["Pack", "Module", "Cell"]
              },
              "condition": {
                "oneOf": [
                  {
                    "type": "string",
                    "enum": ["new", "excellent", "great", "functional", "end_of_life"]
                  },
                  {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/UnitCondition"
                    }
                  }
                ]
              },
              "conditionDeclaration": {
                "type": "string",
                "enum": ["none_damaged", "some_damaged"]
              },
              "damageDetails": { "type": "string" },
              "damageHistory": {
                "type": "array",
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "enum": ["fire_affected", "water_damaged", "impact", "thermal_event"]
                }
              },
              "soh": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "packKwh": {
                "$ref": "#/components/schemas/PositiveMeasurementValue"
              },
              "packWeightKg": {
                "$ref": "#/components/schemas/PositiveMeasurementValue"
              },
              "yearManufacture": {
                "type": "integer",
                "minimum": 2000,
                "maximum": 2035
              },
              "originalApplication": {
                "type": "string",
                "enum": ["EV / automotive", "Home energy storage", "Commercial / grid storage", "Forklift / material handling", "Telecom / UPS", "E-mobility", "New / never used", "Other"]
              },
              "usageDetails": { "type": "string" },
              "dimL": { "type": "string" },
              "dimW": { "type": "string" },
              "dimH": { "type": "string" },
              "architectureVoltage": { "type": "string" },
              "voltageNominal": {
                "$ref": "#/components/schemas/PositiveMeasurementValue"
              },
              "socVolts": {
                "$ref": "#/components/schemas/PositiveMeasurementValue"
              },
              "partNumber": { "type": "string" },
              "vin": { "type": "string" },
              "cycleCount": { "type": "string" },
              "cellFormat": { "type": "string" },
              "cellConfiguration": { "type": "string" },
              "batteryPlatform": { "type": "string" },
              "numCells": { "type": "string" },
              "internalResistance": { "type": "string" },
              "temperature": { "type": "string" },
              "testDate": { "type": "string" },
              "testMethod": { "type": "string" },
              "stateOfCharge": { "type": "string" },
              "hasSafetyDataSheet": { "type": "boolean" },
              "hasComplianceSDS": { "type": "boolean" },
              "hasComplianceUN383": { "type": "boolean" },
              "hasForklift": { "type": "boolean" },
              "collectionSchedule": {
                "$ref": "#/components/schemas/CollectionSchedule"
              },
              "recyclingPackagingDetails": { "type": "string" },
              "address": {
                "$ref": "#/components/schemas/Address"
              }
            }
          }
        ]
      },
      "PatchListingInput": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EditableListingFields"
          }
        ],
        "minProperties": 1,
        "unevaluatedProperties": false
      },
      "EditableListingFields": {
        "type": "object",
        "properties": {
          "channelMode": {
            "type": "string",
            "enum": ["sale", "recycling"],
            "default": "sale"
          },
          "buyItNowPrice": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PositiveMoney"
              },
              {
                "type": "null"
              }
            ]
          },
          "minimumOfferPrice": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PositiveMoney"
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": ["string", "null"],
            "enum": ["GBP", "EUR", "USD", null]
          },
          "reference": {
            "type": ["string", "null"]
          },
          "description": {
            "type": ["string", "null"]
          },
          "manufacturer": {
            "type": ["string", "null"]
          },
          "model": {
            "type": ["string", "null"]
          },
          "chemistry": {
            "type": ["string", "null"]
          },
          "format": {
            "type": ["string", "null"],
            "enum": ["Pack", "Module", "Cell", null]
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 2147483647
          },
          "condition": {
            "oneOf": [
              {
                "type": ["string", "null"],
                "enum": ["new", "excellent", "great", "functional", "end_of_life", null]
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/UnitCondition"
                }
              }
            ]
          },
          "conditionDeclaration": {
            "type": ["string", "null"],
            "enum": ["none_damaged", "some_damaged", null]
          },
          "damageDetails": {
            "type": ["string", "null"]
          },
          "damageHistory": {
            "type": ["array", "null"],
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": ["fire_affected", "water_damaged", "impact", "thermal_event"]
            }
          },
          "soh": {
            "type": ["number", "null"],
            "minimum": 0,
            "maximum": 100
          },
          "packKwh": {
            "$ref": "#/components/schemas/PositiveMeasurement"
          },
          "packWeightKg": {
            "$ref": "#/components/schemas/PositiveMeasurement"
          },
          "yearManufacture": {
            "type": ["integer", "null"],
            "minimum": 2000,
            "maximum": 2035
          },
          "originalApplication": {
            "type": ["string", "null"],
            "enum": ["EV / automotive", "Home energy storage", "Commercial / grid storage", "Forklift / material handling", "Telecom / UPS", "E-mobility", "New / never used", "Other", null]
          },
          "usageDetails": {
            "type": ["string", "null"]
          },
          "dimL": {
            "type": ["string", "null"]
          },
          "dimW": {
            "type": ["string", "null"]
          },
          "dimH": {
            "type": ["string", "null"]
          },
          "architectureVoltage": {
            "type": ["string", "null"]
          },
          "voltageNominal": {
            "$ref": "#/components/schemas/PositiveMeasurement"
          },
          "socVolts": {
            "$ref": "#/components/schemas/PositiveMeasurement"
          },
          "partNumber": {
            "type": ["string", "null"]
          },
          "vin": {
            "type": ["string", "null"]
          },
          "cycleCount": {
            "type": ["string", "null"]
          },
          "cellFormat": {
            "type": ["string", "null"]
          },
          "cellConfiguration": {
            "type": ["string", "null"]
          },
          "batteryPlatform": {
            "type": ["string", "null"]
          },
          "numCells": {
            "type": ["string", "null"]
          },
          "internalResistance": {
            "type": ["string", "null"]
          },
          "temperature": {
            "type": ["string", "null"]
          },
          "testDate": {
            "type": ["string", "null"]
          },
          "testMethod": {
            "type": ["string", "null"]
          },
          "stateOfCharge": {
            "type": ["string", "null"]
          },
          "hasSafetyDataSheet": {
            "type": ["boolean", "null"]
          },
          "hasComplianceSDS": {
            "type": ["boolean", "null"]
          },
          "hasComplianceUN383": {
            "type": ["boolean", "null"]
          },
          "hasForklift": {
            "type": ["boolean", "null"]
          },
          "collectionSchedule": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CollectionSchedule"
              },
              {
                "type": "null"
              }
            ]
          },
          "recyclingPackagingDetails": {
            "type": ["string", "null"]
          },
          "useAccountAddress": {
            "type": "boolean"
          },
          "address": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PositiveMeasurement": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/PositiveMeasurementValue"
          },
          {
            "type": "null"
          }
        ]
      },
      "PositiveMeasurementValue": {
        "type": "number",
        "exclusiveMinimum": 0,
        "maximum": 999999.99
      },
      "PositiveMoney": {
        "type": "number",
        "exclusiveMinimum": 0,
        "maximum": 9999999999.99
      },
      "UnitCondition": {
        "type": "object",
        "required": ["id", "condition"],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "condition": {
            "type": ["string", "null"],
            "enum": ["new", "excellent", "great", "functional", "end_of_life", null]
          },
          "soh": {
            "type": ["number", "null"],
            "minimum": 0,
            "maximum": 100
          },
          "conditionDeclaration": {
            "type": ["string", "null"],
            "enum": ["none_damaged", "some_damaged", null]
          },
          "damageDetails": {
            "type": ["string", "null"]
          }
        },
        "additionalProperties": false
      },
      "Address": {
        "type": "object",
        "required": ["address"],
        "properties": {
          "address": {
            "type": "string",
            "minLength": 1
          },
          "city": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "countryCode": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2
          },
          "postalCode": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CollectionSchedule": {
        "type": "object",
        "required": ["mon", "tue", "wed", "thu", "fri"],
        "properties": {
          "mon": {
            "$ref": "#/components/schemas/ScheduleDay"
          },
          "tue": {
            "$ref": "#/components/schemas/ScheduleDay"
          },
          "wed": {
            "$ref": "#/components/schemas/ScheduleDay"
          },
          "thu": {
            "$ref": "#/components/schemas/ScheduleDay"
          },
          "fri": {
            "$ref": "#/components/schemas/ScheduleDay"
          }
        },
        "additionalProperties": false
      },
      "ScheduleDay": {
        "type": "object",
        "required": ["enabled", "start", "end"],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "start": {
            "type": "string"
          },
          "end": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ImageInput": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "base64": {
            "type": "string",
            "contentEncoding": "base64"
          },
          "contentType": {
            "type": "string",
            "enum": ["image/jpeg", "image/png", "image/webp", "image/avif"]
          },
          "filename": {
            "type": "string"
          }
        },
        "oneOf": [
          {
            "required": ["url"],
            "properties": {
              "url": {},
              "base64": false
            }
          },
          {
            "required": ["base64"],
            "properties": {
              "url": false,
              "base64": {}
            }
          }
        ],
        "additionalProperties": false
      },
      "ListingImage": {
        "type": "object",
        "required": ["id", "url", "sortOrder", "filename"],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "sortOrder": {
            "type": "integer",
            "minimum": 0
          },
          "filename": {
            "type": ["string", "null"]
          }
        },
        "additionalProperties": false
      }
    }
  }
}
