Feature: Ticket GraphQL (category + employee)

  Background: Authorize as employer
    When get access token
    Then access token is valid

  Scenario: Query ticket categories by place_id
    When create place multiple for ticket
    And create ticket category for created place
    And query ticket categories by created place id
    Then ticket_category results are not empty
    And created ticket category is present in results

  Scenario: query employee  by category+company
    When create place multiple for ticket
    And create ticket category for created place
    And create user for ticket
    And create employee for created user
    And create category group for created category
    And connect employee to category group
    When query employee by category and company
    Then employee results are not empty
    And each employee result has id and user fields
    And created employee username is in results

  Scenario: Query employee response shape (may be empty)
    When query employee by category and company
    Then each employee result has id and user fields

  Scenario: Change ticket category and verify employee authorization
    When prepare ticket and categories for category change test
    And change ticket category to in_group category
    And query tickets by created place id
    Then ticket category changed from old to in_group
    And employee is authorized for ticket
    When change ticket category to out_group category
    And query tickets by created place id
    Then employee is NOT authorized for ticket

  Scenario: Assign ticket employee and verify group membership rules
    When prepare ticket and employees for assign employee test
    And assign ticket to fixed in_group employee
    And query tickets by created place id
    Then ticket assignee is fixed employee
    When assign ticket to new in_group employee
    And query tickets by created place id
    Then ticket assignee is new in_group employee
    When assign ticket to out_group employee (should fail)
    And query tickets by created place id
    Then ticket assignee is still new in_group employee

  Scenario: Assign and unassign ticket employee
    When prepare ticket and employees for unassign employee test
    And assign ticket to new grouped employee
    And query tickets by created place id
    Then ticket assignee is new grouped employee
    When unassign ticket from new grouped employee
    And query tickets by created place id
    Then ticket assignee is empty

