import {Resolver, Subscription} from '@nestjs/graphql'
import {ApparatusService} from '../apparatus.service'
import {Apparatus} from '../models/Apparatus'

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

@Resolver(() => Apparatus)
export class ApparatusResolverS {
  constructor(
    private readonly service: ApparatusService,
  ) {}

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

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