/**
 * @aurora-catalyst-generated
 * @source cliter/iam/tenant.aurora.yaml
 */
import { ApiProperty } from '@nestjs/swagger';

export class IamCreateTenantDto {
  @ApiProperty({
    type: String,
    description:
      'Unique identifier for the tenant. UUID v4 format, generated automatically on creation. Used as primary key for referencing this tenant across the system and in all tenant-scoped data queries. Critical for data isolation and multi-tenancy enforcement.',
  })
  id: string;

  @ApiProperty({
    type: String,
    description:
      'Self-referential relationship to parent tenant, enabling hierarchical organizational structures. NULL indicates a root-level tenant with no parent. Non-null values create parent-child relationships for modeling company divisions, subsidiary organizations, or departmental hierarchies. Constraint avoided to prevent circular dependency issues during tenant creation and reorganization. Used for permission inheritance patterns and aggregated reporting across organizational hierarchies.',
    example: 'b36177dc-bc1c-563f-a7db-eb1fafa87614',
  })
  parentId?: string;

  @ApiProperty({
    type: String,
    description:
      'Display name of the tenant organization (e.g., "Acme Corporation", "Sales Department"). Required field used throughout the UI for identifying the tenant context. Should be meaningful and recognizable to users. Used in tenant selection interfaces, headers, and audit logs. Maximum 128 characters to accommodate full legal names or descriptive departmental identifiers.',
  })
  name: string;

  @ApiProperty({
    type: String,
    description:
      'Optional unique identifier code for the tenant, typically used for short references, URL slugs, or integration identifiers. Must be unique across all tenants when provided. Common formats: uppercase acronyms (e.g., "ACME"), lowercase slugs (e.g., "acme-corp"), or external system IDs. NULL indicates no code assigned. Useful for API integrations, subdomain generation, or customer-facing tenant identification without exposing UUIDs. Maximum 64 characters for flexibility with various coding schemes.',
  })
  code?: string;

  @ApiProperty({
    type: Object,
    description:
      'Optional JSON structure storing tenant branding logo information. Typically contains image metadata such as file paths, URLs, dimensions, or base64 data. Example structure: { "url": "/assets/logos/tenant-123.png", "width": 200, "height": 60 }. Used for white-labeling and customizing the UI per tenant. NULL indicates default system logo should be used. JSONB format allows flexible storage of various image metadata formats while supporting efficient querying in PostgreSQL.',
  })
  logo?: any;

  @ApiProperty({
    type: Boolean,
    description:
      "Indicates whether the tenant is currently active and allowed to access the system. Defaults to false (inactive) for controlled onboarding - tenants must be explicitly activated after setup, typically after subscription verification or configuration completion. Inactive tenants cannot authenticate or access any resources, effectively suspending the entire organization's access. Used for subscription management, payment enforcement, or temporary suspension scenarios. This is separate from soft-delete (deletedAt) - inactive tenants can be reactivated without data restoration.",
    example: true,
  })
  isActive: boolean;

  @ApiProperty({
    type: Object,
    description:
      "Optional JSON field for storing custom tenant metadata and configuration properties. Use for tenant-specific settings that don't warrant dedicated columns. Examples: subscription tier, feature flags, billing information, contact details, time zone preferences, localization settings, custom branding colors, or integration configuration. NULL indicates no custom metadata. No schema validation enforced - use carefully with application-level validation. JSONB format enables efficient querying and indexing of specific metadata keys in PostgreSQL.",
  })
  meta?: any;

  @ApiProperty({
    type: [String],
    description:
      'Many-to-many relationship defining which accounts (users/services) belong to this tenant. An account can be associated with multiple tenants, enabling cross-organizational access (e.g., consultants working with multiple clients, shared service accounts). A tenant typically has many accounts representing its users and service integrations. When accounts are added/removed from a tenant, the denormalizedTenantIds array in the account entity is automatically updated for query performance optimization. NULL or empty indicates a tenant with no assigned users (new or archived tenant). Critical for multi-tenancy data isolation and access control enforcement.',
  })
  accountIds?: string[];
}
