import {
  ArgsType,
  Field,
  Float,
  InputType,
  Int,
  ObjectType,
} from '@nestjs/graphql';
import { PaginationArgs } from 'src/core/base/pagination.input';
import { AccountingState } from './accounting-state';
import { TourAccountingFilterDto } from '../feat-business-objects/entities/tour/tours.filter';

@InputType()
export class AccountingFilterArgs implements TourAccountingFilterDto {
  @Field(() => [String], { nullable: true })
  deviation!: 'pos' | 'neg' | 'both'[];
  @Field(() => [String], { nullable: true })
  missing?: 'information' | 'documents'[];
  // @Field(() => IntervalObjectType, { nullable: true })
  // dateRange?: Interval;
}

@ArgsType()
export class AccountingTourArgs extends PaginationArgs {
  @Field(() => AccountingState)
  state!: AccountingState;
  @Field(() => AccountingFilterArgs, { nullable: true })
  filters!: AccountingFilterArgs;
}

@ObjectType('TourStateMeta')
export class TourStateMetaObjectType {
  @Field(() => Int)
  count!: number;
  @Field(() => Float, { nullable: true })
  revenueSum?: number;
  @Field(() => Float, { nullable: true })
  positiveRevenueDeviation?: number;
  @Field(() => Float, { nullable: true })
  negativeRevenueDeviation?: number;
}
