import {Resolver, Subscription} from '@nestjs/graphql'
import {PersonService} from '../person.service'
import {Person} from '../models/Person'

import { pubsub } from '../../main'
import { UUID } from '../../global/scalars/UUID'

@Resolver(() => Person)
export class PersonResolverS {
  constructor(
    private readonly service: PersonService,
  ) {}

  @Subscription(() => Person,{ nullable: true })
  async PersonUpdated() {
    return pubsub.asyncIterator('PersonUpdated');
  }

  @Subscription(() => UUID, { nullable: false })
  async PersonDeleted() {
    return pubsub.asyncIterator('PersonDeleted');
  }
}
