{
  "name": "Workforce - uid",
  "type": "static",
  "attributes": {
    "value": "#if($hasActiveAcct == '1')#if($activeEmployeeVal != 'NONE' && $activeEmployeeVal != 'null')$!activeEmployeeVal#elseif($activeFallbackVal != 'NONE' && $activeFallbackVal != 'null')$!activeFallbackVal#end#elseif($winner == 'acct1')#if($termVal1 != 'NULL' && $termVal1 != 'null')$!termVal1#end#else#if($termVal2 != 'NULL' && $termVal2 != 'null')$!termVal2#end#end",
    "hasActiveAcct": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "type": "accountAttribute",
            "attributes": {
              "sourceName": "Enterprise HR",
              "attributeName": "ACTIVE",
              "accountPropertyFilter": "(ACTIVE == \"1\")"
            }
          },
          "0"
        ],
        "ignoreErrors": "true"
      }
    },
    "activeEmployeeVal": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "type": "accountAttribute",
            "attributes": {
              "sourceName": "Enterprise HR",
              "attributeName": "WORKER_ID",
              "accountSortDescending": true,
              "accountPropertyFilter": "(ACTIVE == \"1\" && WORKER_TYPE == \"Employee\")"
            }
          },
          "NONE"
        ],
        "ignoreErrors": "true"
      }
    },
    "activeFallbackVal": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "type": "accountAttribute",
            "attributes": {
              "sourceName": "Enterprise HR",
              "attributeName": "WORKER_ID",
              "accountSortDescending": true,
              "accountPropertyFilter": "(ACTIVE == \"1\")"
            }
          },
          "NONE"
        ],
        "ignoreErrors": "true"
      }
    },
    "termVal1": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "type": "accountAttribute",
            "attributes": {
              "sourceName": "Enterprise HR",
              "attributeName": "WORKER_ID",
              "accountSortDescending": false,
              "accountReturnFirstLink": true,
              "accountPropertyFilter": "(ACTIVE == \"0\")"
            }
          },
          "NULL"
        ],
        "ignoreErrors": "true"
      }
    },
    "termVal2": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "type": "accountAttribute",
            "attributes": {
              "sourceName": "Enterprise HR",
              "attributeName": "WORKER_ID",
              "accountSortDescending": true,
              "accountReturnFirstLink": true,
              "accountPropertyFilter": "(ACTIVE == \"0\")"
            }
          },
          "NULL"
        ],
        "ignoreErrors": "true"
      }
    },
    "winner": {
      "type": "dateCompare",
      "attributes": {
        "operator": "gte",
        "positiveCondition": "acct1",
        "negativeCondition": "acct2",
        "firstDate": {
          "type": "dateFormat",
          "attributes": {
            "inputFormat": "MM/dd/yyyy",
            "outputFormat": "ISO8601",
            "input": {
              "type": "firstValid",
              "attributes": {
                "values": [
                  {
                    "type": "accountAttribute",
                    "attributes": {
                      "sourceName": "Enterprise HR",
                      "attributeName": "TERMINATION_DATE",
                      "accountSortDescending": false,
                      "accountReturnFirstLink": true,
                      "accountPropertyFilter": "(ACTIVE == \"0\")"
                    }
                  },
                  "01/01/1900"
                ],
                "ignoreErrors": "true"
              }
            }
          }
        },
        "secondDate": {
          "type": "dateFormat",
          "attributes": {
            "inputFormat": "MM/dd/yyyy",
            "outputFormat": "ISO8601",
            "input": {
              "type": "firstValid",
              "attributes": {
                "values": [
                  {
                    "type": "accountAttribute",
                    "attributes": {
                      "sourceName": "Enterprise HR",
                      "attributeName": "TERMINATION_DATE",
                      "accountSortDescending": true,
                      "accountReturnFirstLink": true,
                      "accountPropertyFilter": "(ACTIVE == \"0\")"
                    }
                  },
                  "01/01/1900"
                ],
                "ignoreErrors": "true"
              }
            }
          }
        }
      }
    }
  },
  "internal": false
}
