import type { Meta, StoryObj } from '@storybook/angular';
import { FormBuilder } from '@angular/forms';

import { configProps, stateListData, stateProps } from './mock';

import {{! pick new delimiters for mustache }}{{=<% %>=}}{<%={{ }}=%> {{COMPONENT_CLASS_NAME}}Component {{=<% %>=}}}<%={{ }}=%>{{! revert delimiters for mustache }} from './{{COMPONENT_CLASS_NAME_KEBAB}}.component';

window.PCore.getDataApiUtils = (): any => {
  return {
    getData: () => {
      return Promise.resolve(stateListData);
    }
  };
};

const meta: Meta<{{COMPONENT_CLASS_NAME}}Component> = {
  title: '{{COMPONENT_CLASS_NAME}}',
  component: {{COMPONENT_CLASS_NAME}}Component,
  excludeStories: /.*Data$/,
  render: (args) => ({
      props: {
        ...args,
        pConn$: {
          resolveConfigProps: props => props,
          getConfigProps: () => {
            return configProps;
          },
          getValue: value => {
            return value;
          },
          getContextName: () => {
            return 'app/primary_1';
          },
          getStateProps: () => {
            return stateProps;
          },
          getLocalizedValue: value => {
            return value;
          }
        } as any,
        formGroup$: new FormBuilder().group({})
      }
  })
};

export default meta;
type Story = StoryObj<{{COMPONENT_CLASS_NAME}}Component>;

export const {{COMPONENT_CLASS_NAME}}: Story = {
  args: {}
};
