import { IsEmail, IsString, Matches, MaxLength, MinLength } from 'class-validator'

// Operator-only: invite (or attach) the first admin of a tenant. Same
// inviteTenantAdmin flow the partner wizard uses — creates the Authentik user
// (or attaches an existing one by email), adds them to the tenant group and
// returns a recovery link / temp password the operator shares manually.
export class InviteTenantAdminDto {
  @IsString()
  @Matches(/^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$/, { message: 'invalid tenant slug' })
  tenantSlug!: string

  @IsString() @MinLength(2) @MaxLength(120)
  name!: string

  @IsEmail() @MaxLength(254)
  email!: string
}
