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

import { configProps, worklistData } from './mock';

import { PegaDxilMyPageWidgetComponent } from './pega-dxil-my-page-widget.component';

const meta: Meta<PegaDxilMyPageWidgetComponent> = {
  title: 'PegaDxilMyPageWidget',
  component: PegaDxilMyPageWidgetComponent,
  excludeStories: /.*Data$/,
  render: (args) => {
    window.PCore.getDataApiUtils = (): any => {
      return {
        getData: () => {
          return Promise.resolve(worklistData);
        }
      };
    };
    return {
      props: {
        ...args,
        pConn$: {
          getContextName: () => {
            return 'app/primary_1';
          },
          getLocalizedValue: value => {
            return value;
          },
          getConfigProps: () => {
            return configProps;
          }
        } as any
      }
    };
  }
};

export default meta;
type Story = StoryObj<PegaDxilMyPageWidgetComponent>;

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