## Generated mta.yaml based on yo sap-partner-eng version <%= package_version %>
## appName = <%= app_name %>
## language=nodejs; multiTenant=false
## approuter=<%= router_name %>
_schema-version: '3.1'
ID: <%= app_name %>
version: 0.0.1
description: <%= app_desc %>
parameters:
   enable-parallel-deployments: true
  
  
build-parameters:
  before-all:
   - builder: custom
     commands:
      - npm install
      - npx -p @sap/cds-dk cds build

modules:

### New Modules Here ###

# cf push <%= router_name %> -p <%= router_path %> -n <%= router_name %> -d <%= domain_name %> -k 256M -m 256M
 - name: <%= router_name %>
   type: html5
   path: <%= router_path %>
   build-parameters:
      # Don't package the dependencies if you're running into EINTEGRITY issues
      ignore: ["default-env.json","package-lock.json", "node_modules/"]
      # Suppress the calling of npm install by listing no commands
      builder: custom
      commands: []
   parameters:
      #host: ${org}-${space}-<%= router_name %>
      #domain: <%= domain_name %>
      #routes:
      #  - route: <%= router_name %>-${space}-${app-name}.${default-domain}
      disk-quota: 256M
      memory: 256M
   provides:
    - name: Router_api
      properties:
         url: ${default-url}
         application: ${app-name}
# CDS-MTX
   requires:
   # cf bind-service <%= router_name %> <%= uaa_svc_name %>
    - name: <%= uaa_res_name %>
   ### New Destinations Here ###

resources:

# cf create-service xsuaa application <%= uaa_svc_name %> -c ./cds-security.json
 - name: <%= uaa_res_name %>
   type: org.cloudfoundry.managed-service
   requires:
    - name: Router_api
   properties:
      XSAPPNAME: ${xsuaa-app}
   parameters:
      # Re-run the following command after changing any @(requires: []) definitions in srv/*.cds
      # Run this from the root of the project and uncomment the path:
      # cds compile srv/ --to xsuaa,json > cds-security.json
      #path: ./cds-security.json
      # The combination of path: and config.scopes: Doesn't seem work.  Use one or the other.
      # cds compile srv/ --to xsuaa,yaml and make sure the config: below matches
      #path: ./cds-security.json
      #path: ./xs-security.json
      service: xsuaa
      service-plan: application
      service-name: <%= uaa_svc_name %>
      xsuaa-app: ${space}-~{Router_api/application}
      # Define within config what used to be in the xs-security.json file.  path: now pulls in cds scopes/role templates
      # Convert with https://www.json2yaml.com/
      # https://github.wdf.sap.corp/pages/cap/guides/authorization#role-assignments-with-xsuaa
      config:
         xsappname: ${xsuaa-app}
         ### tenant-mode
         tenant-mode: dedicated
         description: Security profile of the <%= app_name %> application
         scopes:
          - name: "$XSAPPNAME.Callback"
            description: With this scope set, the callbacks for tenant onboarding, offboarding and getDependencies can be called.
            grant-as-authority-to-apps: 
             - "$XSAPPNAME(application,sap-provisioning,tenant-onboarding)"
          - name: "$XSAPPNAME.Administrator"
            description: Administrate the application
          - name: "$XSAPPNAME.User"
            description: Use the application
         role-templates:
          - name: Administrator
            description: Administrator
            scope-references:
             - "$XSAPPNAME.Administrator"
          - name: User
            description: User
            scope-references:
             - "$XSAPPNAME.User"
         oauth2-configuration:
            redirect-uris: 
             - "http*://*.<%= domain_name %>/**"

### New Resources Here ###
