import { ApiProperty } from '@nestjs/swagger';
import { IsInt, IsNumber, IsOptional, IsString, Matches, Min } from 'class-validator';

export class RegisterSaleDto {
  @ApiProperty({ example: '+919876543210' })
  @Matches(/^\+?[1-9]\d{7,14}$/)
  phone!: string;

  @IsOptional()
  @IsString()
  name?: string;

  @IsOptional()
  @IsString()
  email?: string;

  @IsInt()
  @Min(1)
  amount!: number; // rupees

  @IsOptional()
  @IsString()
  notes?: string;

  @IsOptional()
  @IsString()
  applyCouponId?: string;

  @IsOptional()
  @IsNumber()
  customerLat?: number;

  @IsOptional()
  @IsNumber()
  customerLng?: number;
}
