// ---------------------------------------------------------------------------
// ai-foundry-project.bicep
// Deploys a Project workspace inside an existing AI Foundry Hub.
// A project is the unit of work where team members collaborate on models,
// datasets, evaluations, and deployments.
// ---------------------------------------------------------------------------

@description('Name of the project workspace.')
param projectName string

@description('Resource ID of the parent AI Foundry Hub.')
param hubId string

@description('Azure region. Defaults to the resource group location.')
param location string = resourceGroup().location

@description('Tags applied to the project resource.')
param tags object = {}

// ---------------------------------------------------------------------------
// Project resource — kind: project, linked to the parent hub
// ---------------------------------------------------------------------------
resource project 'Microsoft.MachineLearningServices/workspaces@2024-04-01' = {
  name: projectName
  location: location
  tags: tags
  kind: 'project'
  sku: {
    name: 'Basic'
    tier: 'Basic'
  }
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    friendlyName: projectName
    description: 'AI Foundry project deployed via Bicep'
    hubResourceId: hubId
  }
}

// ---------------------------------------------------------------------------
// Outputs
// ---------------------------------------------------------------------------
output projectId string = project.id
output projectName string = project.name
output projectPrincipalId string = project.identity.principalId
