export const ctrlState = () => {
  return {
    controlCodeName: '{{ctrl.codeName}}',
    controlName: '{{ctrl.name}}',
    data: {},
    {{#if ctrl.psAppCounterRefs}}
    appCounterRefs: [
      {{#each ctrl.psAppCounterRefs as | counterRef |}}
        {{#if counterRef.psAppCounter}}
          {{#with counterRef.psAppCounter as | counter |}}
      {
        id: '{{counterRef.id}}',
        getAction: '{{counter.getPSAppDEAction.codeName}}',
        timer: {{#if counter.timer}}{{counter.timer}}{{else}}6000{{/if}},
        {{#if counter.psAppDataEntity}}
        deCodeName: '{{lowerCase counter.psAppDataEntity.codeName}}'
        {{/if}}
      }{{#unless @last}},{{/unless}}
          {{/with}}
        {{/if}}
      {{/each}}
    ],
    counterServices: [],
      {{#if ctrl.psControls}}
        {{#each ctrl.psControls as | viewPanel |}}
          {{#and viewPanel.psAppCounterRef viewPanel.psAppCounterRef.psAppCounter viewPanel.counterId}}
    {{viewPanel.name}}Counter: { id: '{{viewPanel.psAppCounterRef.id}}', counterId: '{{viewPanel.counterId}}' },
          {{/and}}
        {{/each}}
      {{/if}}
    {{/if}}
  }
};