---
openapi: 3.0.3
info:
  title: Catena-X DCM Week Based Material Demand
  description: Open API documentation for the Catena-X DCM Week Based Material Demand
  version: 3.0.0
paths:
  /internal-dcm-application-week-based-material-demand-post-endpoint:
    post:
      tags:
      - WeekBasedMaterialDemand
      operationId: postWeekBasedMaterialDemand
      description: Endpoint to receive a Week Based Material Demand with header information from a Catena-X DCM partner.
      requestBody:
        $ref: '#/components/requestBodies/WeekBasedMaterialDemand'
      responses:
        "200":
          description: OK
        "201":
          description: Created
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "405":
          description: Method not allowed
        "422":
          description: Unprocessable Entity
        "503":
          description: Service Unavailable
components:
  schemas:
    urn_samm_io.catenax.shared.uuid_2.0.0_UuidV4Trait:
      type: string
      description: "The provided regular expression ensures that the UUID is composed\
        \ of five groups of characters separated by hyphens, in the form 8-4-4-4-12\
        \ for a total of 36 characters (32 hexadecimal characters and 4 hyphens),\
        \ optionally prefixed by \"urn:uuid:\" to make it an IRI."
      pattern: "(^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)|(^urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)"
    urn_samm_io.catenax.shared.message_header_3.0.0_ContextCharacteristic:
      type: string
      description: Defining a string value for the context
    urn_samm_org.eclipse.esmf.samm_characteristic_2.1.0_Timestamp:
      type: string
      pattern: "-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\\
        .[0-9]+)?|(24:00:00(\\.0+)?))(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"
      description: Describes a Property which contains the date and time with an optional
        timezone.
    urn_samm_io.catenax.shared.business_partner_number_2.0.0_BpnlTrait:
      type: string
      description: "The provided regular expression ensures that the BPNL is composed\
        \ of prefix 'BPNL', 10 digits and two alphanumeric letters."
      pattern: "^BPNL[a-zA-Z0-9]{12}$"
    urn_samm_io.catenax.shared.message_header_3.0.0_SemanticVersioningTrait:
      type: string
      description: Constraint for defining a SemVer version.
      pattern: "^(0|[1-9][0-9]*).(0|[1-9][0-9]*).(0|[1-9][0-9]*)(-(0|[1-9A-Za-z-][0-9A-Za-z-]*)(.[0-9A-Za-z-]+)*)?([0-9A-Za-z-]+(.[0-9A-Za-z-]+)*)?$"
    urn_samm_io.catenax.shared.message_header_3.0.0_HeaderCharacteristic:
      description: Characteristic describing the common shared aspect Message Header
      type: object
      properties:
        messageId:
          description: "Unique ID identifying the message. The purpose of the ID is\
            \ to uniquely identify a single message, therefore it MUST not be reused."
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.uuid_2.0.0_UuidV4Trait'
        context:
          description: |-
            Information about the context the message should be considered in.
            The value MUST consist of two parts: an identifier of the context (e.g. business domain, etc.) followed by a version number.
            Both the identifier and the version number MUST correspond to the content of the message.
            If the content of a message is described by an aspect model available in the Catena-X Semantic Hub, then the unique identifier of this semantic model (e.g. urn:samm:io.catenax.<ASPECT-MODEL-NAME>:1.x.x) MUST be used as a value of the context field. This is considered the default case.
            In all other cases the value of the context field MUST follow the pattern <domain>-<subdomain>-<object>:<[major] version> (e.g. TRACE-QM-Alert:1.x.x).
            Versioning only refers to major versions in both default and fallback cases.
            Note: The version of the message's header is specified in the version field.
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.message_header_3.0.0_ContextCharacteristic'
        sentDateTime:
          description: Time zone aware timestamp holding the date and the time the
            message was sent by the sending party. The value MUST be formatted according
            to the ISO 8601 standard
          $ref: '#/components/schemas/urn_samm_org.eclipse.esmf.samm_characteristic_2.1.0_Timestamp'
        senderBpn:
          description: The Business Partner Number of the sending party. The value
            MUST be a valid BPN. BPNA and BPNS are not allowed. Applicable constraints
            are defined in the corresponding standard
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.business_partner_number_2.0.0_BpnlTrait'
        receiverBpn:
          description: The Business Partner Number of the receiving party. The value
            MUST be a valid BPN. BPNA and BPNS are not allowed. Applicable constraints
            are defined in the corresponding standard.
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.business_partner_number_2.0.0_BpnlTrait'
        expectedResponseBy:
          description: Time zone aware timestamp holding the date and time by which
            the sending party expects a certain type of response from the receiving
            party. The meaning and interpretation of the fields's value are context-bound
            and MUST therefore be defined by any business domain or platform capability
            making use of it. The value MUST be formatted according to the ISO 8601
            standard
          $ref: '#/components/schemas/urn_samm_org.eclipse.esmf.samm_characteristic_2.1.0_Timestamp'
        relatedMessageId:
          description: Unique ID identifying a message somehow related to the current
            one
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.uuid_2.0.0_UuidV4Trait'
        version:
          description: The unique identifier of the aspect model defining the structure
            and the semantics of the message's header. The version number should reflect
            the versioning schema of aspect models in Catena-X.
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.message_header_3.0.0_SemanticVersioningTrait'
      required:
      - messageId
      - context
      - sentDateTime
      - senderBpn
      - receiverBpn
      - version
    MessageHeaderAspect:
      description: Aspect model describing the shared message header.
      type: object
      properties:
        header:
          description: Contains standardized attributes for message processing common
            across several use cases.
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.message_header_3.0.0_HeaderCharacteristic'
      required:
      - header
    urn_samm_io.catenax.shared.business_partner_number_2.0.0_BpnsTrait:
      type: string
      description: "The provided regular expression ensures that the BPNS is composed\
        \ of prefix 'BPNS', 10 digits and two alphanumeric letters."
      pattern: "^BPNS[a-zA-Z0-9]{12}$"
    DemandCategoryDefault:
      type: object
      properties:
        demandCategoryCode:
          description: The code identifying a demand category.
          type: string
          enum:
          - '0001'
      required:
      - demandCategoryCode
    DemandCategoryAfterSales:
      type: object
      properties:
        demandCategoryCode:
          description: The code identifying a demand category.
          type: string
          enum:
          - A1S1
      required:
      - demandCategoryCode
    DemandCategorySeries:
      type: object
      properties:
        demandCategoryCode:
          description: The code identifying a demand category.
          type: string
          enum:
          - SR99
      required:
      - demandCategoryCode
    DemandCategoryPhaseInPeriod:
      type: object
      properties:
        demandCategoryCode:
          description: The code identifying a demand category.
          type: string
          enum:
          - PI01
      required:
      - demandCategoryCode
    DemandCategorySingleOrder:
      type: object
      properties:
        demandCategoryCode:
          description: The code identifying a demand category.
          type: string
          enum:
          - OS01
      required:
      - demandCategoryCode
    DemandCategorySmallSeries:
      type: object
      properties:
        demandCategoryCode:
          description: The code identifying a demand category.
          type: string
          enum:
          - OI01
      required:
      - demandCategoryCode
    DemandCategoryExtraordinaryDemand:
      type: object
      properties:
        demandCategoryCode:
          description: The code identifying a demand category.
          type: string
          enum:
          - ED01
      required:
      - demandCategoryCode
    DemandCategoryPhaseOutPeriod:
      type: object
      properties:
        demandCategoryCode:
          description: The code identifying a demand category.
          type: string
          enum:
          - PO01
      required:
      - demandCategoryCode
    urn_samm_io.catenax.week_based_material_demand_3.0.0_DemandCategoryCharacteristic:
      description: The classification of demands used for prioritization or allocation.
      type: object
      oneOf:
      - $ref: '#/components/schemas/DemandCategoryDefault'
      - $ref: '#/components/schemas/DemandCategoryAfterSales'
      - $ref: '#/components/schemas/DemandCategorySeries'
      - $ref: '#/components/schemas/DemandCategoryPhaseInPeriod'
      - $ref: '#/components/schemas/DemandCategorySingleOrder'
      - $ref: '#/components/schemas/DemandCategorySmallSeries'
      - $ref: '#/components/schemas/DemandCategoryExtraordinaryDemand'
      - $ref: '#/components/schemas/DemandCategoryPhaseOutPeriod'
    urn_samm_io.catenax.week_based_material_demand_3.0.0_QuantityTrait:
      type: number
      description: Constraint to ensure a non-negative value for quantities.
      maximum: 999999999999999999.999
      exclusiveMaximum: false
      minimum: 0
      exclusiveMinimum: false
    urn_samm_io.catenax.week_based_material_demand_3.0.0_PointInTimeCharacteristic:
      type: string
      format: date
      description: |-
        - If demand rate is "calendar week": An ISO calendar week in which a given demand is needed. Must be given as date of the Monday in the week. (ISO-8601-1:2019)
        - If demand rate is "day": An ISO day on which a given demand is needed. Must be given as single day (consider the time zone of the customer's location). (ISO-8601)
    urn_samm_io.catenax.week_based_material_demand_3.0.0_Demand:
      description: A single demand for a given point in time according to the demand
        rate.
      type: object
      properties:
        demand:
          description: ' Quantity of materials required in the specified point in
            time according specified demand rate. This demand should be as close as
            possible to demand that is derived from the actual production program.'
          $ref: '#/components/schemas/urn_samm_io.catenax.week_based_material_demand_3.0.0_QuantityTrait'
        pointInTime:
          description: Defines the start of the demand rate as a point in time. The
            point in time must be interpreted according to the demand rate.
          $ref: '#/components/schemas/urn_samm_io.catenax.week_based_material_demand_3.0.0_PointInTimeCharacteristic'
      required:
      - demand
      - pointInTime
    urn_samm_io.catenax.week_based_material_demand_3.0.0_DemandDateSeries:
      description: The demands in a given time period for a given demand rate.
      type: array
      items:
        $ref: '#/components/schemas/urn_samm_io.catenax.week_based_material_demand_3.0.0_Demand'
      uniqueItems: true
    urn_samm_io.catenax.week_based_material_demand_3.0.0_DemandSeries:
      description: Encapsulates the demand series related information.
      type: object
      properties:
        customerLocation:
          description: The Business Partner Number Site (BPNS) of the site at which
            the customer needs the specified material for this demand series.
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.business_partner_number_2.0.0_BpnsTrait'
        demandCategory:
          description: Type of demand for this demand series.
          $ref: '#/components/schemas/urn_samm_io.catenax.week_based_material_demand_3.0.0_DemandCategoryCharacteristic'
        demands:
          description: A time series with a specified demand rate along a given time
            period to describe the demand values for this demand series.
          $ref: '#/components/schemas/urn_samm_io.catenax.week_based_material_demand_3.0.0_DemandDateSeries'
        expectedSupplierLocation:
          description: The Business Partner Number Site (BPNS) of the site from where
            the customer expects the supplier to fulfill the demands of the demand
            series. The value is used for informational purposes only and is therefore
            not binding for the supplier.
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.business_partner_number_2.0.0_BpnsTrait'
      required:
      - customerLocation
      - demandCategory
      - demands
    urn_samm_io.catenax.week_based_material_demand_3.0.0_DemandSeriesSet:
      description: A set of demand series belonging to a certain material demand.
        Each demand series in the set must have a unique combination of customer location
        and demand category.
      type: array
      items:
        $ref: '#/components/schemas/urn_samm_io.catenax.week_based_material_demand_3.0.0_DemandSeries'
      uniqueItems: true
    urn_samm_io.catenax.shared.quantity_2.0.0_ItemUnitEnumeration:
      type: string
      pattern: "[a-zA-Z]*:[a-zA-Z]+"
      description: Enumeration for common item units.
      enum:
      - unit:piece
      - unit:set
      - unit:pair
      - unit:page
      - unit:cycle
      - unit:kilowattHour
      - unit:gram
      - unit:kilogram
      - unit:tonneMetricTon
      - unit:tonUsOrShortTonUkorus
      - unit:ounceAvoirdupois
      - unit:pound
      - unit:metre
      - unit:centimetre
      - unit:kilometre
      - unit:inch
      - unit:foot
      - unit:yard
      - unit:squareCentimetre
      - unit:squareMetre
      - unit:squareInch
      - unit:squareFoot
      - unit:squareYard
      - unit:cubicCentimetre
      - unit:cubicMetre
      - unit:cubicInch
      - unit:cubicFoot
      - unit:cubicYard
      - unit:litre
      - unit:millilitre
      - unit:hectolitre
      - unit:secondUnitOfTime
      - unit:minuteUnitOfTime
      - unit:hourUnitOfTime
      - unit:day
    urn_samm_io.catenax.week_based_material_demand_3.0.0_MaterialNumber:
      type: string
      description: "The material number is a multi-character string, usually assigned\
        \ by an ERP system."
    urn_samm_io.catenax.week_based_material_demand_3.0.0_MaterialDescription:
      type: string
      description: Description of a material demand.
    urn_samm_io.catenax.week_based_material_demand_3.0.0_Timestamp:
      type: string
      format: date-time
      description: Point in time.
    urn_samm_org.eclipse.esmf.samm_characteristic_2.1.0_Boolean:
      type: boolean
      description: Represents a boolean value (i.e. a "flag").
    WeekBasedMaterialDemand:
      description: "The requirements of a customer towards a specific supplier for\
        \ a specific material. Each material demand is unique by its Customer, Supplier\
        \ and Material Number."
      type: object
      properties:
        materialDemandId:
          description: The Material Demand ID uniquely identifies the material demand
            within the business relationship between a customer and its supplier.
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.uuid_2.0.0_UuidV4Trait'
        demandSeries:
          description: "The demands for a dedicated material in a given time period\
            \ of a given demand rate, distinguished by their demand location and demand\
            \ category."
          $ref: '#/components/schemas/urn_samm_io.catenax.week_based_material_demand_3.0.0_DemandSeriesSet'
        customer:
          description: The Business Partner Number Legal Entity (BPNL) of the party
            requesting materials from a supplier.
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.business_partner_number_2.0.0_BpnlTrait'
        supplier:
          description: The Business Partner Number Legal Entity (BPNL) of the party
            providing materials to a customer.
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.business_partner_number_2.0.0_BpnlTrait'
        unitOfMeasure:
          description: Unit of measurement for demand quantities.
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.quantity_2.0.0_ItemUnitEnumeration'
        materialNumberCustomer:
          description: Material identifier as assigned by customer. This material
            number identifies the material (as planned) in customer's database. Must
            be unique for each Material Demand in the customer-supplier relationship.
          $ref: '#/components/schemas/urn_samm_io.catenax.week_based_material_demand_3.0.0_MaterialNumber'
        materialNumberSupplier:
          description: Material identifier as assigned by supplier. This material
            number identifies the material (as planned) in supplier's database.
          $ref: '#/components/schemas/urn_samm_io.catenax.week_based_material_demand_3.0.0_MaterialNumber'
        materialDescriptionCustomer:
          description: Description of the material.
          $ref: '#/components/schemas/urn_samm_io.catenax.week_based_material_demand_3.0.0_MaterialDescription'
        changedAt:
          description: "Point in time when the content (any property according to\
            \ the data model) of the material demand was changed, at the customer,\
            \ either by a human user or an automated process."
          $ref: '#/components/schemas/urn_samm_io.catenax.week_based_material_demand_3.0.0_Timestamp'
        materialGlobalAssetId:
          description: Identifier used uniquely to identify part type twin.
          $ref: '#/components/schemas/urn_samm_io.catenax.shared.uuid_2.0.0_UuidV4Trait'
        unitOfMeasureIsOmitted:
          description: Explicit indicator of whether the unit of measure is left out
            of the payload intentionally. If "true" it means the sending application
            sends demand values without unit of measure intentionally and the unit
            of measure MUST NOT be contained in the payload. If "false" a unit of
            measure MUST be supplied.
          $ref: '#/components/schemas/urn_samm_org.eclipse.esmf.samm_characteristic_2.1.0_Boolean'
        materialDemandIsInactive:
          description: Indicates that this material demand is currently not in use/maintained
            by the supplier.
          $ref: '#/components/schemas/urn_samm_org.eclipse.esmf.samm_characteristic_2.1.0_Boolean'
      required:
      - materialDemandId
      - demandSeries
      - customer
      - supplier
      - materialNumberCustomer
      - materialDescriptionCustomer
      - changedAt
      - unitOfMeasureIsOmitted
      - materialDemandIsInactive
    InformationObject:
      description: Bundles all business objects in this property.
      type: array
      items:
        $ref: '#/components/schemas/WeekBasedMaterialDemand'
      uniqueItems: true
    Content:
      description: Object to bundle all transferred business objects.
      type: object
      properties:
        informationObject:
          description: Property to collect all transferred business objects.
          $ref: '#/components/schemas/InformationObject'
    WeekBasedMaterialDemandWithHeader:
      description: An entity that combines the WeekBasedMaterialDemand with the message header data model in order to be compliant with the DCM standard for the exchange of a material demand.
      type: object
      properties:
        messageHeader:
          description: The Capacity Group ID uniquely identifies the capacity group
            within the business relationship between a supplier and its customer.
          $ref: '#/components/schemas/MessageHeaderAspect'
        content:
          description: Bundles all business objects in this property.
          $ref: '#/components/schemas/Content'
  requestBodies:
    WeekBasedMaterialDemand:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/WeekBasedMaterialDemandWithHeader'