// Fixture with packages imported, but nothing else
import { Construct } from 'constructs';
import { Stack } from '@aws-cdk/core';
import appsync = require('@aws-cdk/aws-appsync');
const pluralize = require('pluralize');

const args = {
  after: appsync.GraphqlType.string(),
  first: appsync.GraphqlType.int(),
  before: appsync.GraphqlType.string(),
  last: appsync.GraphqlType.int(),
};

const Node = new appsync.InterfaceType('Node', {
  definition: { id: appsync.GraphqlType.string() }
});

const FilmNode = new appsync.ObjectType('FilmNode', {
  interfaceTypes: [Node],
  definition: { filmName: appsync.GraphqlType.string() }
});

function generateEdgeAndConnection(base: appsync.ObjectType) {
  const edge = new appsync.ObjectType(`${base.name}Edge`, {
    definition: { node: base.attribute(), cursor: appsync.GraphqlType.string() }
  });
  const connection = new appsync.ObjectType(`${base.name}Connection`, {
    definition: {
      edges: edge.attribute({ isList: true }),
      [pluralize(base.name)]: base.attribute({ isList: true }),
      totalCount: appsync.GraphqlType.int(),
    }
  });
  return { edge: edge, connection: connection };
}

const demo = new appsync.ObjectType('Demo', {
  definition: {
    id: appsync.GraphqlType.string({ isRequired: true }),
    version: appsync.GraphqlType.string({ isRequired: true }),
  },
});

class Fixture extends Stack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    /// here
  }
}
