@deprecated
@fansifter_permissions
Feature: Permissions for local rep audience creation

  @FS-5125
  Rule: Local rep users have restricted audience creation capabilities
    Local rep users should have specific limitations when creating audiences:
    - Location filters are limited to local rep countries only
    - Only Advertising audience can be created for local rep artists
    - Email Campaign audience creation shows error for local rep artists
    - Multi-artist selection shows merged countries based on local rep rights
    - Existing audiences cannot be updated to Email Campaign use

    Background: Login as user with Columbia Records Group audience and email access
      Given an orchard employee fansifter-set-2-13-sagittarius visits fansifter
      When I try to log in to fansifter

    @id_74d6476fbd1d5cbea14c2a499a12d0b3f4bca082fd50509b72ecd55a50e8c52c
    Scenario: Local rep location filtering for countries and cities
      Given I have the audience data:
        | Account      | Columbia Records Group |
        | Audience Use | Advertising            |
        | Artists      | Calvin Harris          |
      When I open Audiences page
      And I open New audience page
      And I open artist multiselect for new audience
      And I select "Calvin Harris" artist in multiselect for new audience and close
      Then the audience location "Australia" is available in the dropdown
      And the audience location "United Kingdom" is not listed in the dropdown
      And the audience location "United States" is not listed in the dropdown
      When I add "Sydney" city to the location for new audience
      And I add "Melbourne" city to the location for new audience
      Then I can't add "New York" city to the location for new audience

    @cleanup-created-audience
    @id_c5fbe309af2c5b5186875d6e9c0b65f51dcc78a69bc17c87077c2d0f7be0e809
    Scenario: Local rep cannot create or update Email Campaign audiences
      # Test artist not available in email campaign search
      When I open Audiences page
      And I open New audience page
      And I select Email campaign audience use
      And I open artist dropdown for new audience
      Then artist "Calvin Harris" is not available for selection in dropdown

      # Test advertising creation works
      When I select Advertising campaign audience use
      And I open artist multiselect for new audience
      And I select "Calvin Harris" artist in multiselect for new audience and close
      And I select "Australia" location for new audience
      And I enter random audience name
      And I click on the Save button for new audience
      Then new audience is created

      # Test update to email fails
      When I click edit audience button
      And I select Email campaign audience use
      Then I see fan data lists error message "You can send emails for artists when you are the rep owner"

    @id_08e5c39016ad589e077904702dccea28dbabab77f3626b36a2ab2d381f5f306d
    Scenario: Multi-artist selection shows merged countries based on local rep rights
      Given I have the audience data:
        | Account      | Columbia Records Group |
        | Audience Use | Advertising            |
      When I open Audiences page
      And I open New audience page
      And I open artist multiselect for new audience
      And I select "Rag'n'Bone Man" artist in multiselect for new audience
      And I select "Calvin Harris" artist in multiselect for new audience
      And I close artist multiselect for new audience
      Then the audience location "United States" is available in the dropdown
      And the audience location "Australia" is available in the dropdown
      And the audience location "United Kingdom" is not listed in the dropdown

    @cleanup-created-audience
    @id_335d759964259777760c31327e046e2ba45beb6254340a2f912012cd6e69fb31
    Scenario: Existing local rep audience cannot be updated to Email Campaign use
      Given I have the audience data:
        | Account      | Columbia Records Group |
        | Audience Use | Advertising            |
        | Artists      | Rag'n'Bone Man         |
        | Fan location | United States          |
      When I open Audiences page
      And I open New audience page
      And I fill new audience data
      And I click on the Save button for new audience
      Then new audience is created
      When I click edit audience button
      And I select Email campaign audience use
      Then I see fan data lists error message "You can send emails for artists when you are the rep owner"

  @FS-5126
  Rule: Local rep users can't create email campaigns for artists they do not own

    Background: Login as user with Columbia Records Group audience and email access
      Given an orchard employee fansifter-set-2-13-sagittarius visits fansifter
      When I try to log in to fansifter

    @email-campaigns
    @id_ef639eebd61c43cbb5919f21832bba9e69913b243f79e6e8e2947e0c824fd2e9
    Scenario: Local rep cannot see non-owned artists in email campaign creation
      # Verify user lands on My Roster and artist exists in roster
      Then I am on My Roster page
      When I search for "Rag'n'Bone Man" on My Roster page
      And I receive My Roster data from backend
      Then I see only "Rag'n'Bone Man" name in My Roster table

      # Test email campaign creation restrictions
      When I open Email Campaigns page
      And I click on "New Email" button on Email campaigns page
      Then I see Create Email Campaign modal opened
      And I see "Columbia Records Group (34514)" account selected and disabled in Create Email Campaign modal
      When I open artist dropdown in Create Email Campaign modal
      Then artist "Rag'n'Bone Man" is not available for selection in email campaign dropdown
