import {
  IsNotEmpty,
  IsOptional,
  IsString,
  Matches,
  MaxLength,
  IsObject,
} from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class CreateTenantDto {
  @ApiProperty({ example: 'ACME Corporation' })
  @IsString()
  @IsNotEmpty()
  @MaxLength(200)
  name!: string;

  @ApiProperty({
    example: 'acme-corp',
    description: 'URL-freundlicher Kurzname (a-z, 0-9, Bindestrich)',
  })
  @IsString()
  @IsNotEmpty()
  @MaxLength(50)
  @Matches(/^[a-z0-9][a-z0-9-]*[a-z0-9]$/, {
    message: 'Slug: nur Kleinbuchstaben, Zahlen und Bindestriche erlaubt',
  })
  slug!: string;

  @ApiProperty({
    example: { locale: 'de-DE', timezone: 'Europe/Berlin' },
    required: false,
  })
  @IsOptional()
  @IsObject()
  settings?: Record<string, unknown>;
}
