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

import { PegaDxilMyRadiobuttonsComponent } from './pega-dxil-my-radiobuttons.component';

const meta: Meta<PegaDxilMyRadiobuttonsComponent> = {
  title: 'PegaDxilMyRadiobuttons',
  component: PegaDxilMyRadiobuttonsComponent,
  excludeStories: /.*Data$/,
  render: (args) => ({
    props: {
      ...args,
      pConn$: {
        resolveConfigProps: props => props,
        getConfigProps: () => {
          return configProps;
        },
        getContextName: () => {
          return 'app/primary_1/workarea_3';
        },
        getStateProps: () => {
          return stateProps;
        },
        getDataObject: () => {
          return;
        },
        getActionsApi: () => {
          return {
            updateFieldValue: () => {
              /* nothing */
            },
            triggerFieldChange: () => {
              /* nothing */
            }
          };
        },
        getCaseInfo: () => {
          return {
            getClassName: () => {
              return 'DIXL-MediaCo-Work-NewService';
            }
          };
        },
        getLocalizedValue: val => {
          return val;
        },
        getLocaleRuleNameFromKeys: () => {
          return undefined;
        },
        clearErrorMessages: ({}) => {}
      } as any,
      formGroup$: new FormBuilder().group({})
    }
  })
};

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

export const PegaDxilMyRadiobuttons: Story = {
  args: {
    label$: configProps.label,
    helperText: configProps.helperText,
    testId: configProps.testId,
    bReadonly$: configProps.readOnly,
    bDisabled$: configProps.disabled,
    bRequired$: configProps.required,
    displayMode$: configProps.displayMode
  }
};
