import pageTwig from './node.page.full.twig';
import pageData from './node.page.full.yml';
import './node.page.full.js';

import { impactTitle } from '@ui-paragraph/impact-title/component/paragraph.impact-title.stories.js';
import { oneColumn } from '@ui-layouts/layouts.stories.js';

import { setPublishedStatus } from '.storybook/utils';

/**
 * Storybook Definition.
 */
export default {
  title: 'Content Types/Page/Full',
};

export const full = (args) => {
  let data = JSON.parse(JSON.stringify(pageData ?? {}));
  data = Object.assign(data, args);

  data.node = setPublishedStatus(data.node_is_published);

  return pageTwig({
    ...data,
    node_field_erp_sections: oneColumn(),
  });
};
full.args = pageData;

export const withImpactTitle = (args) => {
  let data = JSON.parse(JSON.stringify(pageData ?? {}));
  data = Object.assign(data, args);

  data.node = setPublishedStatus(data.node_is_published);
  return pageTwig({
    ...data,
    node_field_erp_impact_title: impactTitle({
      paragraph_field_title: data.paragraph_field_title,
      paragraph_is_published: data.paragraph_is_published,
    }),
    node_field_erp_sections: oneColumn(),
  });
};
withImpactTitle.args = {
  ...pageData,
  ...impactTitle.args,
};
