import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'
import GraphQLUpload from 'graphql-upload/GraphQLUpload.js'
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'

import { NotificationRule, NotificationRuleStatus } from './notification-rule'

@InputType()
export class NewNotificationRule {
  @Field()
  name: string

  @Field({ nullable: true })
  description?: string

  @Field(type => NotificationRuleStatus, { nullable: true })
  state?: NotificationRuleStatus

  @Field({ nullable: true })
  active?: boolean

  @Field({ nullable: true })
  title: string

  @Field({ nullable: true })
  body: string

  @Field({ nullable: true })
  url: string

  @Field(type => GraphQLUpload, { nullable: true })
  thumbnail?: FileUpload
}

@InputType()
export class NotificationRulePatch {
  @Field(type => ID, { nullable: true })
  id?: string

  @Field({ nullable: true })
  name?: string

  @Field({ nullable: true })
  description?: string

  @Field(type => NotificationRuleStatus, { nullable: true })
  state?: NotificationRuleStatus

  @Field({ nullable: true })
  title: string

  @Field({ nullable: true })
  body: string

  @Field({ nullable: true })
  url: string

  @Field(type => GraphQLUpload, { nullable: true })
  thumbnail?: FileUpload

  @Field({ nullable: true })
  cuFlag?: string
}

@ObjectType()
export class NotificationRuleList {
  @Field(type => [NotificationRule])
  items: NotificationRule[]

  @Field(type => Int)
  total: number
}
