{type:"func", params:[{name:"equip"}, {name:"dates"}, {name:"occStatus", def:{type:"literal", val:true}}], body:{type:"block", exprs:[{type:"if", cond:{type:"and", lhs:{type:"eq", lhs:{type:"var", name:"occStatus"}, rhs:{type:"literal", val:false}}, rhs:{type:"dotCall", target:{type:"var", name:"has"}, args:[{type:"var", name:"equip"}, {type:"literal", val:"op247"}]}}, ifExpr:{type:"return", expr:{type:"dotCall", target:{type:"var", name:"addColMeta"}, args:[{type:"dotCall", target:{type:"var", name:"hisPeriodIntersection"}, args:[{type:"list", vals:[{type:"literal", val:null}, {type:"literal", val:null}]}]}, {type:"literal", val:"v0"}, {type:"dict", names:["occupMethod"], vals:[{type:"literal", val:5}]}]}}, elseExpr:{type:"if", cond:{type:"and", lhs:{type:"eq", lhs:{type:"var", name:"occStatus"}, rhs:{type:"literal", val:true}}, rhs:{type:"dotCall", target:{type:"var", name:"has"}, args:[{type:"var", name:"equip"}, {type:"literal", val:"op247"}]}}, ifExpr:{type:"return", expr:{type:"dotCall", target:{type:"var", name:"addColMeta"}, args:[{type:"call", target:{type:"var", name:"hisSlidingWindows"}, args:[{type:"var", name:"dates"}, {type:"literal", val:24}, {type:"literal", val:24h}]}, {type:"literal", val:"v0"}, {type:"dict", names:["occupMethod"], vals:[{type:"literal", val:5}]}]}}}}, {type:"def", name:"equipSched", val:{type:"list", vals:[]}}, {type:"if", cond:{type:"eq", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"call", target:{type:"var", name:"equipOccupancy"}, args:[{type:"var", name:"equip"}]}]}, rhs:{type:"literal", val:0}}, ifExpr:{type:"assign", lhs:{type:"var", name:"equipSched"}, rhs:{type:"dotCall", target:{type:"var", name:"hisRead"}, args:[{type:"call", target:{type:"var", name:"equipOccupancy"}, args:[{type:"var", name:"equip"}]}, {type:"var", name:"dates"}]}}, elseExpr:{type:"if", cond:{type:"eq", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"dotCall", target:{type:"var", name:"findAll"}, args:[{type:"call", target:{type:"var", name:"equipOccupancy"}, args:[{type:"var", name:"equip"}]}, {type:"func", params:[{name:"x"}], body:{type:"eq", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"call", target:{type:"var", name:"readAll"}, args:[{type:"and", lhs:{type:"var", name:"oi"}, rhs:{type:"and", lhs:{type:"or", lhs:{type:"eq", lhs:{type:"var", name:"oIStatus"}, rhs:{type:"literal", val:"newIssue"}}, rhs:{type:"or", lhs:{type:"eq", lhs:{type:"var", name:"oIStatus"}, rhs:{type:"literal", val:"forReview"}}, rhs:{type:"and", lhs:{type:"eq", lhs:{type:"var", name:"oIStatus"}, rhs:{type:"literal", val:"approved"}}, rhs:{type:"eq", lhs:{type:"var", name:"oIArmsStatus"}, rhs:{type:"literal", val:"Under Review"}}}}}, rhs:{type:"and", lhs:{type:"eq", lhs:{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"ruleRef"}, {type:"literal", val:"abcRuleId"}]}, rhs:{type:"literal", val:"rule216"}}, rhs:{type:"eq", lhs:{type:"var", name:"targetRef"}, rhs:{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"x"}, {type:"literal", val:"id"}]}}}}}]}]}, rhs:{type:"literal", val:0}}}]}]}, rhs:{type:"literal", val:0}}, ifExpr:{type:"assign", lhs:{type:"var", name:"equipSched"}, rhs:{type:"dotCall", target:{type:"var", name:"hisRead"}, args:[{type:"literal", val:null}, {type:"var", name:"dates"}]}}, elseExpr:{type:"assign", lhs:{type:"var", name:"equipSched"}, rhs:{type:"dotCall", target:{type:"var", name:"map"}, args:[{type:"dotCall", target:{type:"var", name:"findAll"}, args:[{type:"dotCall", target:{type:"var", name:"toRecList"}, args:[{type:"dotCall", target:{type:"var", name:"findAll"}, args:[{type:"call", target:{type:"var", name:"equipOccupancy"}, args:[{type:"var", name:"equip"}]}, {type:"func", params:[{name:"x"}], body:{type:"eq", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"call", target:{type:"var", name:"readAll"}, args:[{type:"and", lhs:{type:"var", name:"oi"}, rhs:{type:"and", lhs:{type:"or", lhs:{type:"eq", lhs:{type:"var", name:"oIStatus"}, rhs:{type:"literal", val:"newIssue"}}, rhs:{type:"or", lhs:{type:"eq", lhs:{type:"var", name:"oIStatus"}, rhs:{type:"literal", val:"forReview"}}, rhs:{type:"and", lhs:{type:"eq", lhs:{type:"var", name:"oIStatus"}, rhs:{type:"literal", val:"approved"}}, rhs:{type:"eq", lhs:{type:"var", name:"oIArmsStatus"}, rhs:{type:"literal", val:"Under Review"}}}}}, rhs:{type:"and", lhs:{type:"eq", lhs:{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"ruleRef"}, {type:"literal", val:"abcRuleId"}]}, rhs:{type:"literal", val:"rule216"}}, rhs:{type:"eq", lhs:{type:"var", name:"targetRef"}, rhs:{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"x"}, {type:"literal", val:"id"}]}}}}}]}]}, rhs:{type:"literal", val:0}}}]}]}, {type:"func", params:[{name:"x"}], body:{type:"gt", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"dotCall", target:{type:"var", name:"hisRead"}, args:[{type:"var", name:"x"}, {type:"var", name:"dates"}]}]}, rhs:{type:"literal", val:0}}}]}, {type:"func", params:[{name:"pt"}], body:{type:"dotCall", target:{type:"var", name:"hisClip"}, args:[{type:"dotCall", target:{type:"var", name:"hisFindPeriods"}, args:[{type:"call", target:{type:"var", name:"hisRead"}, args:[{type:"var", name:"pt"}, {type:"var", name:"dates"}]}, {type:"func", params:[{name:"x"}], body:{type:"eq", lhs:{type:"var", name:"x"}, rhs:{type:"var", name:"occStatus"}}}]}]}}]}}}}, {type:"def", name:"floorSched", val:{type:"list", vals:[]}}, {type:"if", cond:{type:"eq", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"call", target:{type:"var", name:"equipFloorOccupancy"}, args:[{type:"var", name:"equip"}]}]}, rhs:{type:"literal", val:0}}, ifExpr:{type:"assign", lhs:{type:"var", name:"floorSched"}, rhs:{type:"dotCall", target:{type:"var", name:"hisClip"}, args:[{type:"dotCall", target:{type:"var", name:"hisRead"}, args:[{type:"call", target:{type:"var", name:"equipFloorOccupancy"}, args:[{type:"var", name:"equip"}]}, {type:"var", name:"dates"}]}]}}, elseExpr:{type:"assign", lhs:{type:"var", name:"floorSched"}, rhs:{type:"dotCall", target:{type:"var", name:"map"}, args:[{type:"dotCall", target:{type:"var", name:"findAll"}, args:[{type:"dotCall", target:{type:"var", name:"toRecList"}, args:[{type:"call", target:{type:"var", name:"equipFloorOccupancy"}, args:[{type:"var", name:"equip"}]}]}, {type:"func", params:[{name:"x"}], body:{type:"gt", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"dotCall", target:{type:"var", name:"hisRead"}, args:[{type:"var", name:"x"}, {type:"var", name:"dates"}]}]}, rhs:{type:"literal", val:0}}}]}, {type:"func", params:[{name:"pt"}], body:{type:"dotCall", target:{type:"var", name:"hisClip"}, args:[{type:"dotCall", target:{type:"var", name:"hisFindPeriods"}, args:[{type:"call", target:{type:"var", name:"hisRead"}, args:[{type:"var", name:"pt"}, {type:"var", name:"dates"}]}, {type:"func", params:[{name:"x"}], body:{type:"eq", lhs:{type:"var", name:"x"}, rhs:{type:"var", name:"occStatus"}}}]}]}}]}}}, {type:"def", name:"equipTypeSched", val:{type:"list", vals:[]}}, {type:"if", cond:{type:"eq", lhs:{type:"call", target:{type:"var", name:"equipTypeOccupancy"}, args:[{type:"var", name:"equip"}]}, rhs:{type:"literal", val:null}}, ifExpr:{type:"eq", lhs:{type:"var", name:"equipTypeSched"}, rhs:{type:"dotCall", target:{type:"var", name:"hisClip"}, args:[{type:"dotCall", target:{type:"var", name:"hisRead"}, args:[{type:"call", target:{type:"var", name:"equipTypeOccupancy"}, args:[{type:"var", name:"equip"}]}, {type:"var", name:"dates"}]}]}}, elseExpr:{type:"assign", lhs:{type:"var", name:"equipTypeSched"}, rhs:{type:"dotCall", target:{type:"var", name:"map"}, args:[{type:"dotCall", target:{type:"var", name:"findAll"}, args:[{type:"dotCall", target:{type:"var", name:"toRecList"}, args:[{type:"call", target:{type:"var", name:"equipTypeOccupancy"}, args:[{type:"var", name:"equip"}]}]}, {type:"func", params:[{name:"x"}], body:{type:"gt", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"dotCall", target:{type:"var", name:"hisRead"}, args:[{type:"var", name:"x"}, {type:"var", name:"dates"}]}]}, rhs:{type:"literal", val:0}}}]}, {type:"func", params:[{name:"pt"}], body:{type:"dotCall", target:{type:"var", name:"hisClip"}, args:[{type:"dotCall", target:{type:"var", name:"hisFindPeriods"}, args:[{type:"call", target:{type:"var", name:"hisRead"}, args:[{type:"var", name:"pt"}, {type:"var", name:"dates"}]}, {type:"func", params:[{name:"x"}], body:{type:"eq", lhs:{type:"var", name:"x"}, rhs:{type:"var", name:"occStatus"}}}]}]}}]}}}, {type:"def", name:"siteSched", val:{type:"dotCall", target:{type:"var", name:"map"}, args:[{type:"dotCall", target:{type:"var", name:"toRecList"}, args:[{type:"call", target:{type:"var", name:"equipSiteOccupancy"}, args:[{type:"var", name:"equip"}]}]}, {type:"func", params:[{name:"pt"}], body:{type:"dotCall", target:{type:"var", name:"hisClip"}, args:[{type:"dotCall", target:{type:"var", name:"hisFindPeriods"}, args:[{type:"call", target:{type:"var", name:"hisRead"}, args:[{type:"var", name:"pt"}, {type:"var", name:"dates"}]}, {type:"func", params:[{name:"x"}], body:{type:"eq", lhs:{type:"var", name:"x"}, rhs:{type:"var", name:"occStatus"}}}]}]}}]}}, {type:"if", cond:{type:"eq", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"call", target:{type:"var", name:"equipSiteOccupancy"}, args:[{type:"var", name:"equip"}]}]}, rhs:{type:"literal", val:0}}, ifExpr:{type:"throw", expr:{type:"call", target:{type:"var", name:"abcRuleErr"}, args:[{type:"add", lhs:{type:"literal", val:"No occupancy schedule is defined for "}, rhs:{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"call", target:{type:"var", name:"readById"}, args:[{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"equip"}, {type:"literal", val:"id"}]}]}, {type:"literal", val:"siteRef"}]}, {type:"literal", val:"dis"}]}}]}}}, {type:"def", name:"occupMethos", val:{type:"literal", val:0}}, {type:"def", name:"occupancySched", val:{type:"literal", val:null}}, {type:"if", cond:{type:"ne", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"var", name:"equipSched"}]}, rhs:{type:"literal", val:0}}, ifExpr:{type:"block", exprs:[{type:"assign", lhs:{type:"var", name:"occupancySched"}, rhs:{type:"var", name:"equipSched"}}, {type:"assign", lhs:{type:"var", name:"occupMethos"}, rhs:{type:"literal", val:1}}]}, elseExpr:{type:"if", cond:{type:"ne", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"var", name:"floorSched"}]}, rhs:{type:"literal", val:0}}, ifExpr:{type:"block", exprs:[{type:"assign", lhs:{type:"var", name:"occupancySched"}, rhs:{type:"var", name:"floorSched"}}, {type:"assign", lhs:{type:"var", name:"occupMethos"}, rhs:{type:"literal", val:2}}]}, elseExpr:{type:"if", cond:{type:"ne", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"var", name:"equipTypeSched"}]}, rhs:{type:"literal", val:0}}, ifExpr:{type:"block", exprs:[{type:"assign", lhs:{type:"var", name:"occupancySched"}, rhs:{type:"var", name:"equipTypeSched"}}, {type:"assign", lhs:{type:"var", name:"occupMethos"}, rhs:{type:"literal", val:3}}]}, elseExpr:{type:"block", exprs:[{type:"assign", lhs:{type:"var", name:"occupancySched"}, rhs:{type:"var", name:"siteSched"}}, {type:"assign", lhs:{type:"var", name:"occupMethos"}, rhs:{type:"literal", val:4}}]}}}}, {type:"def", name:"equipAH", val:{type:"call", target:{type:"var", name:"equipAH"}, args:[{type:"var", name:"equip"}]}}, {type:"def", name:"floorAH", val:{type:"call", target:{type:"var", name:"equipFloorAH"}, args:[{type:"var", name:"equip"}]}}, {type:"def", name:"afterHour", val:{type:"if", cond:{type:"ne", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"var", name:"equipAH"}]}, rhs:{type:"literal", val:0}}, ifExpr:{type:"var", name:"equipAH"}, elseExpr:{type:"if", cond:{type:"ne", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"var", name:"floorAH"}]}, rhs:{type:"literal", val:0}}, ifExpr:{type:"var", name:"floorAH"}}}}, {type:"if", cond:{type:"ne", lhs:{type:"var", name:"afterHour"}, rhs:{type:"literal", val:null}}, ifExpr:{type:"block", exprs:[{type:"def", name:"ahList", val:{type:"list", vals:[]}}, {type:"dotCall", target:{type:"var", name:"each"}, args:[{type:"var", name:"afterHour"}, {type:"func", params:[{name:"ah"}], body:{type:"block", exprs:[{type:"try", tryExpr:{type:"if", cond:{type:"and", lhs:{type:"not", operand:{type:"dotCall", target:{type:"var", name:"isEmpty"}, args:[{type:"var", name:"ah"}]}}, rhs:{type:"and", lhs:{type:"ne", lhs:{type:"var", name:"ah"}, rhs:{type:"literal", val:null}}, rhs:{type:"ne", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"dotCall", target:{type:"var", name:"hisRead"}, args:[{type:"var", name:"ah"}, {type:"var", name:"dates"}]}]}, rhs:{type:"literal", val:0}}}}, ifExpr:{type:"block", exprs:[{type:"assign", lhs:{type:"var", name:"ahList"}, rhs:{type:"dotCall", target:{type:"var", name:"add"}, args:[{type:"var", name:"ahList"}, {type:"dotCall", target:{type:"var", name:"hisFindPeriods"}, args:[{type:"dotCall", target:{type:"var", name:"hisRead"}, args:[{type:"var", name:"ah"}, {type:"var", name:"dates"}]}, {type:"func", params:[{name:"x"}], body:{type:"eq", lhs:{type:"var", name:"x"}, rhs:{type:"var", name:"occStatus"}}}]}]}}]}}, catchExpr:{type:"throw", expr:{type:"call", target:{type:"var", name:"abcRuleErr"}, args:[{type:"dotCall", target:{type:"var", name:"toAxonCode"}, args:[{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"ah"}, {type:"literal", val:"id"}]}]}]}}}]}}]}]}}, {type:"def", name:"cumulatList", val:{type:"list", vals:[]}}, {type:"if", cond:{type:"and", lhs:{type:"ne", lhs:{type:"var", name:"afterHour"}, rhs:{type:"literal", val:null}}, rhs:{type:"and", lhs:{type:"not", operand:{type:"dotCall", target:{type:"var", name:"isEmpty"}, args:[{type:"var", name:"ahList"}]}}, rhs:{type:"eq", lhs:{type:"var", name:"occStatus"}, rhs:{type:"literal", val:true}}}}, ifExpr:{type:"block", exprs:[{type:"assign", lhs:{type:"var", name:"cumulatList"}, rhs:{type:"dotCall", target:{type:"var", name:"add"}, args:[{type:"var", name:"cumulatList"}, {type:"dotCall", target:{type:"var", name:"hisPeriodUnion"}, args:[{type:"var", name:"ahList"}]}]}}, {type:"dotCall", target:{type:"var", name:"each"}, args:[{type:"var", name:"occupancySched"}, {type:"func", params:[{name:"x"}], body:{type:"assign", lhs:{type:"var", name:"cumulatList"}, rhs:{type:"dotCall", target:{type:"var", name:"add"}, args:[{type:"var", name:"cumulatList"}, {type:"var", name:"x"}]}}}]}, {type:"return", expr:{type:"dotCall", target:{type:"var", name:"addColMeta"}, args:[{type:"call", target:{type:"var", name:"hisPeriodUnion"}, args:[{type:"var", name:"cumulatList"}]}, {type:"literal", val:"v0"}, {type:"dict", names:["occupMethod"], vals:[{type:"var", name:"occupMethos"}]}]}}]}, elseExpr:{type:"if", cond:{type:"and", lhs:{type:"ne", lhs:{type:"var", name:"afterHour"}, rhs:{type:"literal", val:null}}, rhs:{type:"and", lhs:{type:"not", operand:{type:"dotCall", target:{type:"var", name:"isEmpty"}, args:[{type:"var", name:"ahList"}]}}, rhs:{type:"eq", lhs:{type:"var", name:"occStatus"}, rhs:{type:"literal", val:false}}}}, ifExpr:{type:"block", exprs:[{type:"assign", lhs:{type:"var", name:"cumulatList"}, rhs:{type:"dotCall", target:{type:"var", name:"add"}, args:[{type:"var", name:"cumulatList"}, {type:"dotCall", target:{type:"var", name:"hisPeriodIntersection"}, args:[{type:"var", name:"ahList"}]}]}}, {type:"dotCall", target:{type:"var", name:"each"}, args:[{type:"var", name:"occupancySched"}, {type:"func", params:[{name:"x"}], body:{type:"assign", lhs:{type:"var", name:"cumulatList"}, rhs:{type:"dotCall", target:{type:"var", name:"add"}, args:[{type:"var", name:"cumulatList"}, {type:"var", name:"x"}]}}}]}, {type:"return", expr:{type:"dotCall", target:{type:"var", name:"addColMeta"}, args:[{type:"call", target:{type:"var", name:"hisPeriodIntersection"}, args:[{type:"var", name:"cumulatList"}]}, {type:"literal", val:"v0"}, {type:"dict", names:["occupMethod"], vals:[{type:"var", name:"occupMethos"}]}]}}]}, elseExpr:{type:"if", cond:{type:"eq", lhs:{type:"var", name:"occStatus"}, rhs:{type:"literal", val:true}}, ifExpr:{type:"return", expr:{type:"dotCall", target:{type:"var", name:"addColMeta"}, args:[{type:"dotCall", target:{type:"var", name:"hisPeriodUnion"}, args:[{type:"var", name:"occupancySched"}]}, {type:"literal", val:"v0"}, {type:"dict", names:["occupMethod"], vals:[{type:"var", name:"occupMethos"}]}]}}, elseExpr:{type:"return", expr:{type:"dotCall", target:{type:"var", name:"addColMeta"}, args:[{type:"dotCall", target:{type:"var", name:"hisPeriodIntersection"}, args:[{type:"var", name:"occupancySched"}]}, {type:"literal", val:"v0"}, {type:"dict", names:["occupMethod"], vals:[{type:"var", name:"occupMethos"}]}]}}}}}]}}