/* @aztlan/generator-front 2.0.9 */
// import * as React from 'react'
import {
  Meta, StoryObj,
} from '@storybook/react'
import { encodeGlobalId } from '@aztlan/react-relay'
import { graphql } from 'react-relay'
import Component from './Edit.js'
// import * as decorators from "story-utils/decorators.js";

const meta: Meta<typeof Component> = {
  title    :'activitystreams/Form/EditEntity',
  component:Component,
}

export default meta

const relayConfig = {
  // query            :PostalAddressMap.QUERY,
  variables:{},
}

const FRAGMENT = graphql`
  fragment EditEntityImageTestFragment on ImageNode {
    id
    summary
    content
    created
    updated
    mediaType
  }
`

const IMAGE_FRAGMENT = FRAGMENT

export const Image: StoryObj<typeof Component> = {
  args:{
    FRAGMENT:IMAGE_FRAGMENT,
    children:'Sample EditEntity',
  },
  parameters:{
    relay:{
      ...relayConfig,
      query:graphql`
        query EditEntityImageTestQuery {
          image(id: "1") {
            ...EditEntityImageTestFragment
          }
        }
      `,
      getReferenceEntry:(data) => [
        'data', // key on receeiving element
        data.image, // accessor
      ],
      mockResolvers:{
        ImageNode:() => ({
          id:encodeGlobalId(
            'Image', '1',
          ),
          summary  :'Sample Image',
          content  :'Sample Image Content',
          created  :'2021-08-31T00:00:00Z',
          updated  :'2021-08-31T00:00:00Z',
          mediaType:'image/png',
        }),
      },
    },
  },
}
