@frontend_royalties
@ows_royalties
@ows_abacus_contract
Feature: Abacus Primary Contract

  @id_e01e43d9ac69f3588c54a9353886b8d45e7507e3a89957dac6b65296afb42795
  Scenario: mark/unmark contract as primary
    Given an orchard employee label_7123_admin_2 for abacus
    When I log in
    And I prepare an abacus account data:
      | Key              | Value                   |
      | companyBrandName | awal                    |
      | paidBy           | AWAL-US                 |
      | agreementType    | AWAL Core               |
      | currency         | EUR                     |
      | owner            | awal                    |
      | paymentMinimum   | 123                     |
      | paymentSchedule  | 45 days after month end |
    And I create a new active account via API
    And I have a Distribution runcontroller created
    And I prepare an abacus contract data:
      | Key           | Value                         |
      | contractType  | Distribution                  |
      | signingEntity | AWAL Recordings America, Inc. |
      | renewalRule   | Continuously Active           |
    And I should be able to create Active contract with this data via new flow
    Then I should be able to set contract as primary
    Then I should be able to unset contract as primary

  @id_cd2ac2f975546bec2b7ada907137330bd88dc33336e6005ade4fce95a565c7b4
  Scenario: contract is listed as primary on contracts list page
    Given an orchard employee label_7123_admin_5 for abacus
    When I log in
    And I prepare an abacus account data:
      | Key              | Value                   |
      | companyBrandName | awal                    |
      | paidBy           | AWAL-US                 |
      | agreementType    | AWAL Core               |
      | currency         | EUR                     |
      | owner            | awal                    |
      | paymentMinimum   | 123                     |
      | paymentSchedule  | 45 days after month end |
    And I create a new account via API
    And I have a Distribution runcontroller created
    And I prepare an abacus contract data:
      | Key           | Value                         |
      | contractType  | Distribution                  |
      | signingEntity | AWAL Recordings America, Inc. |
      | renewalRule   | Continuously Active           |
    And I should be able to create Active contract with this data via new flow
    Then I should be able to set contract as primary
    And I prepare an abacus contract data:
      | Key           | Value                                   |
      | contractType  | Distribution                            |
      | signingEntity | AWAL Recordings Licensing America, Inc. |
      | renewalRule   | Continuously Active                     |
    And I should be able to create Active contract with this data via new flow
    Then I should be able to see the primary contract on contracts list page

  @id_49f18def05da6bf2567a3228ed6020e51b103528cc252789695f0da21d618e37
  Scenario: I should be able to change primary contract
    Given an orchard employee label_7123_admin_5 for abacus
    When I log in
    And I prepare an abacus account data:
      | Key              | Value                   |
      | companyBrandName | awal                    |
      | paidBy           | AWAL-US                 |
      | agreementType    | AWAL Core               |
      | currency         | EUR                     |
      | owner            | awal                    |
      | paymentMinimum   | 123                     |
      | paymentSchedule  | 45 days after month end |
    And I create a new account via API
    And I have a Distribution runcontroller created
    And I prepare an abacus contract data:
      | Key           | Value                         |
      | contractType  | Distribution                  |
      | signingEntity | AWAL Recordings America, Inc. |
      | renewalRule   | Continuously Active           |
    And I should be able to create Active contract with this data via new flow
    Then I should be able to set contract as primary
    And I prepare an abacus contract data:
      | Key           | Value                                   |
      | contractType  | Distribution                            |
      | signingEntity | AWAL Recordings Licensing America, Inc. |
      | renewalRule   | Continuously Active                     |
    And I should be able to create Active contract with this data via new flow
    Then I should be able to set different contract as primary

  @id_4c89721ed64619ba6c179a5b1a8fdd9993dd37e17488737adc2d1830071290d8
  Scenario: I should be able to create contract as primary during creation
    Given an orchard employee label_7123_admin_5 for abacus
    When I log in
    And I prepare an abacus account data:
      | Key              | Value                   |
      | companyBrandName | awal                    |
      | paidBy           | AWAL-US                 |
      | agreementType    | AWAL Core               |
      | currency         | EUR                     |
      | owner            | awal                    |
      | paymentMinimum   | 123                     |
      | paymentSchedule  | 45 days after month end |
    And I create a new account via API
    And I have a Distribution runcontroller created
    And I should be able to create primary contract
