import { Type } from 'class-transformer';
import {
  ArrayMaxSize,
  ArrayMinSize,
  IsArray,
  IsBoolean,
  IsNumber,
  IsOptional,
  Max,
  Min,
  ValidateNested,
} from 'class-validator';
import { LatLngDto } from './directions-route.dto';

export class SnapPathDto {
  @IsArray()
  @ArrayMinSize(2)
  @ArrayMaxSize(500)
  @ValidateNested({ each: true })
  @Type(() => LatLngDto)
  points!: LatLngDto[];

  /** When true (default), Google inserts points along the road between samples. */
  @IsOptional()
  @IsBoolean()
  interpolate?: boolean;
}

export class SnapPathPointDto {
  @IsNumber()
  @Min(-90)
  @Max(90)
  lat!: number;

  @IsNumber()
  @Min(-180)
  @Max(180)
  lng!: number;
}
