import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import {
  IsString,
  IsOptional,
  IsUUID,
  IsUrl,
  MaxLength,
  Matches,
  IsBoolean,
  IsHexColor,
} from 'class-validator';

export class CreateBrandDto {
  @ApiProperty({ description: 'ID del cliente', format: 'uuid' })
  @IsUUID()
  client_id: string;

  @ApiProperty({ description: 'Nombre de la marca', maxLength: 255 })
  @IsString()
  @MaxLength(255)
  name: string;

  @ApiPropertyOptional({
    description: 'Slug URL-friendly',
    maxLength: 100,
  })
  @IsOptional()
  @IsString()
  @MaxLength(100)
  @Matches(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, {
    message: 'Slug must be lowercase letters, numbers, and hyphens only',
  })
  slug?: string;

  @ApiPropertyOptional({ description: 'Descripcion de la marca' })
  @IsOptional()
  @IsString()
  description?: string;

  @ApiPropertyOptional({ description: 'URL del logo', maxLength: 500 })
  @IsOptional()
  @IsUrl()
  @MaxLength(500)
  logo_url?: string;

  @ApiPropertyOptional({ description: 'Color primario (hex)', example: '#3B82F6' })
  @IsOptional()
  @IsHexColor()
  primary_color?: string;

  @ApiPropertyOptional({ description: 'Color secundario (hex)', example: '#10B981' })
  @IsOptional()
  @IsHexColor()
  secondary_color?: string;

  @ApiPropertyOptional({ description: 'Voz de la marca / tono de comunicacion' })
  @IsOptional()
  @IsString()
  brand_voice?: string;

  @ApiPropertyOptional({ description: 'Audiencia objetivo' })
  @IsOptional()
  @IsString()
  target_audience?: string;

  @ApiPropertyOptional({ description: 'URL del manual de marca', maxLength: 500 })
  @IsOptional()
  @IsUrl()
  @MaxLength(500)
  guidelines_url?: string;

  @ApiPropertyOptional({ description: 'Marca activa', default: true })
  @IsOptional()
  @IsBoolean()
  is_active?: boolean;

  @ApiPropertyOptional({ description: 'Metadata adicional' })
  @IsOptional()
  metadata?: Record<string, any>;
}
