import { InputType, Field, registerEnumType } from '@nestjs/graphql';
import GraphQLJSON from 'graphql-type-json';

export enum Gender {
  MALE = 'male',
  FEMALE = 'female',
  OTHER = 'other',
  PREFER_NOT_TO_SAY = 'prefer_not_to_say',
}

registerEnumType(Gender, { name: 'Gender' });

@InputType()
export class CreateChildInput {
  @Field()
  familyId: string;

  @Field()
  name: string;

  @Field()
  birthDate: Date;

  @Field(() => Gender, { nullable: true })
  gender?: Gender;

  @Field({ nullable: true })
  photoUrl?: string;

  @Field(() => GraphQLJSON, { nullable: true })
  medicalInfo?: any;
}

@InputType()
export class UpdateChildInput {
  @Field({ nullable: true })
  name?: string;

  @Field({ nullable: true })
  birthDate?: Date;

  @Field(() => Gender, { nullable: true })
  gender?: Gender;

  @Field({ nullable: true })
  photoUrl?: string;

  @Field(() => GraphQLJSON, { nullable: true })
  medicalInfo?: any;
}
