const mockField = (componentName: string, configProps: Record<string, unknown>) => ({
  getPConnect: () => ({
    getComponentName: () => componentName,
    getConfigProps: () => configProps,
    resolveConfigProps: () => configProps,
    getStateProps: () => ({ value: '' }),
    getDataObject: () => ({}),
    getCaseInfo: () => ({ getClassName: () => 'MyCo-MyCompon-Work-MyComponents' }),
    getLocalizedValue: (value: string) => value,
    getLocaleRuleNameFromKeys: () => '',
    getActionsApi: () => ({
      updateFieldValue: () => {
        /* nothing */
      },
      triggerFieldChange: () => {
        /* nothing */
      }
    }),
    clearErrorMessages: () => {
      /* nothing */
    }
  })
});

export const pyReviewRaw = {
  name: 'pyReview',
  type: 'View',
  config: {
    template: 'Details',
    ruleClass: 'MyCo-MyCompon-Work-MyComponents',
    showLabel: true,
    label: '@L Details',
    localeReference: '@LR MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW',
    showHighlightedData: true,
    highlightedData: [
      {
        type: 'TextInput',
        config: {
          value: '@P .pyStatusWork',
          label: '@L Work Status',
          displayMode: 'STACKED_LARGE_VAL',
          displayAsStatus: true
        }
      },
      {
        type: 'TextInput',
        config: {
          value: '@P .pyID',
          label: '@L Case ID',
          displayMode: 'STACKED_LARGE_VAL'
        }
      },
      {
        type: 'DateTime',
        config: {
          value: '@P .pxCreateDateTime',
          label: '@L Create date/time',
          displayMode: 'STACKED_LARGE_VAL'
        }
      },
      {
        type: 'UserReference',
        config: {
          label: '@L Create Operator',
          value: '@USER .pxCreateOperator',
          placeholder: 'Select...',
          displayMode: 'STACKED_LARGE_VAL'
        }
      }
    ],
    inheritedProps: [
      {
        prop: 'label',
        value: '@L Details'
      },
      {
        prop: 'showLabel',
        value: true
      }
    ]
  },
  children: [
    {
      name: 'A',
      type: 'Region',
      getPConnect: () => {
        return {
          getComponentName: () => 'Region',
          getChildren: () => [
            mockField('TextInput', {
              readOnly: undefined,
              placeholder: 'First Name',
              value: 'John',
              label: 'First Name',
              hasSuggestions: false,
              displayMode: 'DISPLAY_ONLY'
            }),
            mockField('TextInput', {
              readOnly: undefined,
              placeholder: 'Middle Name',
              value: '',
              label: 'Middle Name',
              hasSuggestions: false,
              displayMode: 'DISPLAY_ONLY'
            }),
            mockField('TextInput', {
              readOnly: undefined,
              placeholder: 'Last Name',
              value: 'Doe',
              label: 'Last Name',
              hasSuggestions: false,
              displayMode: 'DISPLAY_ONLY'
            }),
            mockField('Email', {
              value: 'john@doe.com',
              label: 'Email',
              required: true,
              testId: 'CE8AE9DA5B7CD6C3DF2929543A9AF92D',
              hasSuggestions: false,
              displayMode: 'DISPLAY_ONLY'
            }),
            mockField('Phone', {
              readOnly: undefined,
              value: '+16397975093',
              label: 'Phone',
              displayMode: 'DISPLAY_ONLY',
              hasSuggestions: false
            }),
            mockField('Currency', {
              readOnly: undefined,
              value: '90.99',
              label: 'Price',
              displayMode: 'DISPLAY_ONLY',
              hasSuggestions: false
            }),
            mockField('RadioButtons', {
              readOnly: undefined,
              value: '1000 Mbps',
              label: 'Internet Plan',
              listType: 'associated',
              datasource: [
                { key: '100 Mbps', value: '100 Mbps' },
                { key: '1000 Mbps', value: '1000 Mbps' }
              ],
              displayMode: 'DISPLAY_ONLY',
              hasSuggestions: false
            })
          ]
        };
      }
    }
  ]
};
