{
  "eventsAndFunctions": [
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "Load",
            "expression": "Select(ExtCommonBusiness.ListBusinessSegmentCategories({}),[id,name])\n\n",
            "widgetName": "cbxCatName"
          },
          {
            "command": "ReadModel",
            "modelVariableName": "businessSegment",
            "variableName": "businessSegment"
          },
          {
            "children": [
              {
                "command": "Disable",
                "widgetName": "txtCode"
              }
            ],
            "command": "If",
            "expression": "IsNotNull(^businessSegment) && IsNotNull(^businessSegment.id)"
          },
          {
            "children": [
              {
                "command": "Enable",
                "widgetName": "txtCode"
              }
            ],
            "command": "Else"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "businessSegment",
            "type": "ExtCommonBusiness.BusinessSegment"
          }
        ]
      },
      "name": "main_init"
    },
    {
      "algorithm": {
        "parameters": [],
        "statements": [
          {
            "command": "ReadModel",
            "modelVariableName": "businessSegment",
            "variableName": "businessSegment"
          },
          {
            "children": [
              {
                "command": "Throw",
                "errorName": "Error",
                "expressionData": "\"[[ErrorFillingFormTitle]]\"",
                "expressionInnerError": "\"[[ErrorFillingFormMsg]]\""
              }
            ],
            "command": "If",
            "expression": "IsNull(^businessSegment)"
          },
          {
            "command": "Set",
            "expression": "\"BusinessSegmentCategory\"",
            "variableName": "businessSegment.BusinessSegmentCategory.type"
          },
          {
            "children": [
              {
                "command": "Execute",
                "expression": "ExtCommonBusiness.UpdateBusinessSegment(^businessSegment.id, ^businessSegment)"
              }
            ],
            "command": "If",
            "expression": "IsNotNull(^businessSegment) && IsNotNull(^businessSegment.id)"
          },
          {
            "children": [
              {
                "command": "Execute",
                "expression": "ExtCommonBusiness.CreateBusinessSegment(^businessSegment)"
              }
            ],
            "command": "Else"
          }
        ],
        "typeReturn": "any",
        "variables": [
          {
            "name": "businessSegment",
            "type": "ExtCommonBusiness.BusinessSegment"
          }
        ]
      },
      "name": "main_submit"
    }
  ],
  "model": [
    {
      "name": "businessSegment",
      "required": true,
      "type": "ExtCommonBusiness.BusinessSegment"
    }
  ],
  "root": {
    "children": [
      {
        "children": [
          {
            "children": [
              {
                "binding": "businessSegment.code",
                "label": "[[Code]]",
                "last": true,
                "name": "txtCode",
                "size": 2,
                "widget": "TextBox"
              },
              {
                "binding": "businessSegment.name",
                "label": "[[Name]]",
                "last": true,
                "name": "txtName",
                "size": 2,
                "widget": "TextBox"
              },
              {
                "binding": "businessSegment.BusinessSegmentCategory.id",
                "dataFormat": "KeyValueList",
                "label": "[[Category]]",
                "name": "cbxCatName",
                "size": 2,
                "widget": "ComboBox"
              }
            ],
            "cssClass": "blz-padding-top-large blz-padding-left-large",
            "layout": "form"
          }
        ],
        "layout": "fit"
      }
    ],
    "cssClass": "blz-area-default",
    "layout": "responsive",
    "name": "mainResponsive"
  },
  "routing": null,
  "unused": []
}