import { Transform } from 'class-transformer';
import { IsNotEmpty, IsOptional, Matches } from 'class-validator';

export class CreateGroupDto {
  @IsNotEmpty({ message: 'Name Should Not be Empty.' })
  @Transform(({ value }) => value.trim().replace(/\s+/g, ' '))
  name: string;

  @IsNotEmpty({ message: 'Description Should Not be Empty.' })
  @Transform(({ value }) => value.trim().replace(/\s+/g, ' '))
  description: string;

  @IsNotEmpty({ message: 'Step Goals Should Not be Empty.' })
  @Transform(({ value }) => value.trim().replace(/\s+/g, ' '))
  step_goal: string;

  @IsOptional()
  zipcode: string;

  @IsNotEmpty({ message: 'Owner role Should Not be Empty.' })
  @Transform(({ value }) => value.trim().replace(/\s+/g, ' '))
  owner_role: string;

  @IsNotEmpty({ message: 'Province Id Should Not be Empty.' })
  province_id: string;

  owner_id: string;

  icon: string;
  goal_start_date: Date;
  goal_end_date: Date;
  status: number;

  @IsOptional()
  is_sharable: boolean;
}
