import { ArgsType, Field, InputType } from '@nestjs/graphql';
import { ApprovalState, TicketValidationState } from '@prisma/client';
import { PaginationArgs } from 'src/core/base/pagination.input';
import { TicketFilter } from '../feat-business-objects/entities/ticket/ticket-filter';

@InputType()
export class TicketFilterArgs implements TicketFilter {
  @Field(() => [String], { nullable: true })
  errors: string[];
  @Field(() => [ApprovalState], { nullable: true })
  approvalStates: ApprovalState[];
  @Field(() => [String], { nullable: true })
  documentInfo: ('approval' | 'transport_document')[];
}

@ArgsType()
export class TicketsArgs extends PaginationArgs {
  @Field(() => TicketValidationState)
  state: TicketValidationState;
  @Field(() => TicketFilterArgs, { nullable: true })
  filters: TicketFilterArgs;
}

@InputType()
export class ApprovalInfoArgs {
  @Field({ nullable: true })
  isNeeded?: boolean;
  @Field({ nullable: true })
  whoRequested?: string;
  @Field({ nullable: true })
  answeredFrom?: string;
  @Field({ nullable: true })
  location?: string;
}

@ArgsType()
export class DocumentInfoArgs {
  @Field(() => ApprovalInfoArgs, { nullable: true })
  approval: ApprovalInfoArgs;
  @Field({ nullable: true })
  tdLocation?: string;
}
