# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/documentation/api-scenario/references/v1.2/schema.json
scope: ResourceGroup
variables:
  accountName:
    type: string
    prefix: accountn
  assetName:
    type: string
    prefix: assetnam
  transformName:
    type: string
    prefix: transfor
  jobName:
    type: string
    prefix: jobname
  testStorageAccount:
    type: string
    prefix: teststorageaccount
prepareSteps:
  - step: CreateStorageAccount
    operationId: StorageAccounts_Create
    readmeTag: ../../../../../../../storage/resource-manager/readme.md
    parameters:
      accountName: $(testStorageAccount)
      parameters:
        kind: StorageV2
        location: $(location)
        sku:
          name: Standard_LRS
          tier: "Standard"
  - step: CreateAccount
    operationId: Mediaservices_CreateOrUpdate
    exampleFile: ../../../../Accounts/stable/2021-11-01/examples/async-accounts-create.json
    requestUpdate:
      - replace: /parameters/properties/storageAccounts/0/id
        value: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Storage/storageAccounts/$(testStorageAccount)

scenarios:
  - scenario: EncodingTests
    steps:
      - operationId: Transforms_CreateOrUpdate
        exampleFile: ../examples/transforms-create.json
      - operationId: Transforms_List
        exampleFile: ../examples/transforms-list-all.json
      - operationId: Transforms_Get
        exampleFile: ../examples/transforms-get-by-name.json
      - operationId: Transforms_Update
        exampleFile: ../examples/transforms-update.json
      - operationId: Assets_CreateOrUpdate
        exampleFile: ../../../../Metadata/stable/2022-08-01/examples/assets-create.json
        variables:
          assetName: $(jobName)-InputAsset
        requestUpdate:
          - replace: /parameters/properties/storageAccountName
            value: $(testStorageAccount)
      - operationId: Assets_CreateOrUpdate
        exampleFile: ../../../../Metadata/stable/2022-08-01/examples/assets-create.json
        variables:
          assetName: $(jobName)-OutputAsset
        requestUpdate:
          - replace: /parameters/properties/storageAccountName
            value: $(testStorageAccount)
      - operationId: Jobs_Create
        exampleFile: ../examples/jobs-create.json
      - operationId: Jobs_List
        exampleFile: ../examples/jobs-list-all.json
      - operationId: Jobs_Get
        exampleFile: ../examples/jobs-get-by-name.json
      - operationId: Jobs_Update
        exampleFile: ../examples/jobs-update.json      
      - operationId: Jobs_CancelJob
        exampleFile: ../examples/jobs-cancel.json
      # disabling delete job test as it might fail based on its state based on above steps, it's possible that the job is still in scheduling or cancelling state.
      # this might conflict with the next steps of the test.
      # example : delete might fails, as the job might go in to canceling state and stay in that state for a while.
      # - operationId: Jobs_Delete
      #   exampleFile: ../examples/jobs-delete.json
      - operationId: Transforms_Delete
        exampleFile: ../examples/transforms-delete.json
