import { ArrayUnique, IsArray, IsOptional, Matches } from 'class-validator';

/**
 * Confirm a Goods Received Note. Omit `containerNumbers` to GRN every
 * received-but-un-GRN'd container on the booking (per-booking when that's all of
 * them); pass a subset to GRN just those.
 */
export class GenerateGrnDto {
  @IsOptional()
  @IsArray()
  @ArrayUnique()
  @Matches(/^[A-Z]{4}\d{7}$/, {
    each: true,
    message: 'each container number must match ISO container format, e.g. ABCD1234567',
  })
  containerNumbers?: string[];
}
