/* @aztlan/generator-front 3.1.2 */
import {
  Meta, StoryObj,
} from '@storybook/react'
import { graphql } from 'react-relay'
import decorators from 'story-utils/decorators.js'
import { RawLogin as Component } from './Login.js'

const meta: Meta<typeof Component> = {
  title     :'pages/Login',
  component :Component,
  decorators:[
    // @ts-ignore
    decorators.components.StaticRouter,
    decorators.components.Intl,
  ],
  parameters:{ layout: 'fullscreen' },
}

const FRAGMENT = graphql`
  fragment LoginButtonFragment on Query
  @argumentDefinitions(resource: { type: "String!" }) {
    oAuth2Links(resource: $resource) {
      google
    }
  }
`

export default meta

const relay = {
  query:graphql`
    query LoginQuery {
      ...LoginButtonFragment @arguments(resource: "mydomain.com/redirect")
    }
  `,
  getReferenceEntry:(data) => [
    'data',
    data,
  ],
  mockResolvers:{ OAuth2LinksProvider: () => ({ google: 'http://google.com/oauth2login' }) },
}

export const Base: StoryObj<typeof Component> = {
  args:{
    FRAGMENT,
    resource:'https://mydomain.com/access_after_auth',
  },
  parameters:{ relay },
}
