{ "$schema":                "https://json-schema.org/draft/2020-12/schema",
  "$id":                    "https://schemas.mpai.community/MMM4/V3.0/actions/LicensePA.json",
  "title":                  "LicensePA",
  "description":            "License Process Action (MMM-LCS): the User offering an Asset gives the User interested in the offer a Licence for it, with the Transact Service. MMM-TEC V2.2 listed the License Process Action and its modifiers (Nil, To, With) without the elements of its request and response; MMM-TEC V3.0 specifies them, modelled on those of Post (MMM-PTP) and on the Licence Data Type (MMM-LIC).",
  "type":                   "object",
  "required":               [ "Header", "MInstanceID", "Time" ],
  "properties":             {

    "Header":               { "type": "string", "const": "MMM-LCS-V3.0" },
    "MInstanceID":          { "type": "string" },
    "UEnvironmentID":       { "type": "string" },
    "LicensePAID":          { "type": "string" },
    "LicensePATime":        { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SimpleTime.json" },

    "Time":                 { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SimpleTime.json" },

    "LicensePARQ":          { "type": "object", "properties": {
      "RQ1":                { "type": "object", "properties": {
        "Complement":       { "type": "string", "const": "Nil" },
        "AssetID":          { "type": "string" } } },
      "RQ2":                { "type": "object", "properties": {
        "Complement":       { "type": "string", "const": "To" },
        "LicenseeID":       { "type": "array", "items": { "type": "string" } } } },
      "RQ3":                { "type": "object", "properties": {
        "Complement":       { "type": "string", "const": "With" },
        "L-Rights":         { "$ref": "https://schemas.mpai.community/MMM4/V2.2/data/Rights.json" } } },
      "RQ4":                { "type": "object", "properties": {
        "Complement":       { "type": "string", "const": "With" },
        "Licence":          { "$ref": "https://schemas.mpai.community/MMM4/V2.2/data/Licence.json" } } },
      "RQ5":                { "type": "object", "properties": {
        "Complement":       { "type": "string", "const": "With" },
        "SPM":              { "$ref": "https://schemas.mpai.community/MMM4/V2.2/data/ServicePricingModel.json" } } } } },

    "LicensePARS":          { "type": "object", "properties": {
      "RS1":                { "type": "object", "properties": {
        "Complement":       { "type": "string", "const": "With" },
        "Licence":          { "$ref": "https://schemas.mpai.community/MMM4/V2.2/data/Licence.json" } } },
      "RS2":                { "type": "object", "properties": {
        "Complement":       { "type": "string", "const": "With" },
        "PAStatus":         { "type": "array", "items": { "oneOf": [
                            { "type": "object", "properties": {
          "Err":            { "type": "string", "enum": [ "FaultyPA", "IncID", "InsRights", "InsValue", "LicRef" ] } } },
                            { "type": "object", "properties": {
          "Ack":            { "type": "string", "enum": [ "Ack" ] } } } ] } } } } } },

    "DataXMData":           { "$ref": "https://schemas.mpai.community/PTF/V1.0/data/DataExchangeMetadata.json" },
    "DescrMetadata":        { "type": "string", "maxLength": 2048 } },

  "oneOf": [                { "required": [ "LicensePARQ" ], "not": { "required": [ "LicensePARS" ] } },
                            { "required": [ "LicensePARS" ], "not": { "required": [ "LicensePARQ" ] } } ] }
