describe('League Creation Flow', () => {
  // Note: All tests that require authentication are skipped
  // The /leagues/new route requires Clerk authentication
  
  it.skip('should display the league creation form', () => {
    // Requires authentication
    cy.visit('/leagues/new');
    
    // Check that form elements exist
    cy.get('input[name="name"]').should('exist');
    cy.get('#teamCount').should('exist'); // Radix Select trigger
    cy.get('#draftRounds').should('exist'); // Radix Select trigger
    cy.get('select[name="draftSpeed"]').should('exist'); // Native select
  });

  it.skip('should validate required fields', () => {
    // Requires authentication
    cy.visit('/leagues/new');

    // Try to submit without filling anything
    cy.get('button[type="submit"]').click();

    // Should show validation or stay on page
    cy.url().should('include', '/leagues/new');
  });

  it.skip('should show draft speed options', () => {
    // Requires authentication
    cy.visit('/leagues/new');

    // Native select for draft speed
    cy.get('select[name="draftSpeed"]').select('fast');
    cy.get('select[name="draftSpeed"]').should('have.value', 'fast');

    cy.get('select[name="draftSpeed"]').select('standard');
    cy.get('select[name="draftSpeed"]').should('have.value', 'standard');

    cy.get('select[name="draftSpeed"]').select('slow');
    cy.get('select[name="draftSpeed"]').should('have.value', 'slow');
  });

  it.skip('should allow selecting team count', () => {
    // Requires authentication
    cy.visit('/leagues/new');

    // Click Radix Select trigger
    cy.get('#teamCount').click();
    
    // Select from dropdown
    cy.contains('[role="option"]', '12 Teams').click();
    
    // Verify selection
    cy.get('#teamCount').should('contain', '12 Teams');
  });

  it.skip('should allow selecting draft rounds', () => {
    // Requires authentication
    cy.visit('/leagues/new');

    // Click Radix Select trigger
    cy.get('#draftRounds').click();
    
    // Select from dropdown
    cy.contains('[role="option"]', '20').click();
    
    // Verify selection
    cy.get('#draftRounds').should('contain', '20');
  });

  it.skip('should create a new league with all settings', () => {
    // Requires authentication and database setup
    cy.visit('/leagues/new');

    // Fill in league details
    cy.get('input[name="name"]').type('My Test League');
    
    // Select team count (Radix Select)
    cy.get('#teamCount').click();
    cy.contains('[role="option"]', '12 Teams').click();
    
    // Select draft rounds (Radix Select)
    cy.get('#draftRounds').click();
    cy.contains('[role="option"]', '20').click();

    // Set draft speed (native select)
    cy.get('select[name="draftSpeed"]').select('standard');

    // Submit form
    cy.get('button[type="submit"]').click();

    // Verify redirect to league page
    cy.url().should('include', '/leagues/');
    cy.findByText('My Test League').should('exist');
  });
});
