from agentops.common.route_config import RouteConfig

from .views.users import (
    get_user,
    update_user,
    update_user_survey_complete,
)

from .views.orgs import (
    get_user_orgs,
    get_org,
    create_org,
    update_org,
    invite_to_org,
    get_org_invites,
    get_org_invites_for_org,
    accept_org_invite,
    remove_from_org,
    change_member_role,
    delete_org,
    revoke_org_invite,
    create_checkout_session,
    create_free_subscription,
    validate_discount_code,
    cancel_subscription,
    reactivate_subscription,
    update_subscription,
    create_customer_portal_session,
    update_member_licenses,
    get_stripe_pricing,
    get_subscription_detail,
    preview_member_add_cost,
)

from .views.projects import (
    get_projects,
    get_project,
    create_project,
    update_project,
    delete_project,
    regenerate_api_key,
)

from .views.billing import BillingDashboardView

route_config: list[RouteConfig] = [
    # User routes
    RouteConfig(
        name='get_user',
        path="/users/me",
        endpoint=get_user,
        methods=["GET"],
    ),
    RouteConfig(
        name='update_user',
        path="/users/update",
        endpoint=update_user,
        methods=["POST"],
    ),
    RouteConfig(
        name='update_user_survey_complete',
        path="/users/complete_survey",
        endpoint=update_user_survey_complete,
        methods=["POST"],
    ),
    # Organization routes
    RouteConfig(
        name='get_user_orgs',
        path="/orgs",
        endpoint=get_user_orgs,
        methods=["GET"],
    ),
    RouteConfig(
        name='get_org_invites',
        path="/orgs/invites",
        endpoint=get_org_invites,
        methods=["GET"],
    ),
    RouteConfig(
        name='get_org_invites_for_org',
        path="/orgs/{org_id}/invites",
        endpoint=get_org_invites_for_org,
        methods=["GET"],
    ),
    RouteConfig(
        name='get_org',
        path="/orgs/{org_id}",
        endpoint=get_org,
        methods=["GET"],
    ),
    RouteConfig(
        name='create_org',
        path="/orgs/create",
        endpoint=create_org,
        methods=["POST"],
    ),
    RouteConfig(
        name='update_org',
        path="/orgs/{org_id}/update",
        endpoint=update_org,
        methods=["POST"],
    ),
    RouteConfig(
        name='invite_to_org',
        path="/orgs/{org_id}/invite",
        endpoint=invite_to_org,
        methods=["POST"],
    ),
    RouteConfig(
        name='accept_org_invite',
        path="/orgs/{org_id}/accept",
        endpoint=accept_org_invite,
        methods=["POST"],
    ),
    RouteConfig(
        name='remove_from_org',
        path="/orgs/{org_id}/members/remove",
        endpoint=remove_from_org,
        methods=["POST"],
    ),
    RouteConfig(
        name='change_member_role',
        path="/orgs/{org_id}/members/update",
        endpoint=change_member_role,
        methods=["POST"],
    ),
    RouteConfig(
        name='update_member_licenses',
        path="/orgs/{org_id}/members/licenses",
        endpoint=update_member_licenses,
        methods=["PUT"],
    ),
    RouteConfig(
        name='delete_org',
        path="/orgs/{org_id}",
        endpoint=delete_org,
        methods=["DELETE"],
    ),
    RouteConfig(
        name='create_checkout_session',
        path="/orgs/{org_id}/create-checkout-session",
        endpoint=create_checkout_session,
        methods=["POST"],
    ),
    RouteConfig(
        name='create_free_subscription',
        path="/orgs/{org_id}/create-free-subscription",
        endpoint=create_free_subscription,
        methods=["POST"],
    ),
    RouteConfig(
        name='validate_discount_code',
        path="/orgs/{org_id}/validate-discount-code",
        endpoint=validate_discount_code,
        methods=["POST"],
    ),
    RouteConfig(
        name='cancel_subscription',
        path="/orgs/{org_id}/cancel-subscription",
        endpoint=cancel_subscription,
        methods=["POST"],
    ),
    RouteConfig(
        name='reactivate_subscription',
        path="/orgs/{org_id}/reactivate-subscription",
        endpoint=reactivate_subscription,
        methods=["POST"],
    ),
    RouteConfig(
        name='get_subscription_detail',
        path="/orgs/{org_id}/subscription-detail",
        endpoint=get_subscription_detail,
        methods=["GET"],
    ),
    RouteConfig(
        name='update_subscription',
        path="/orgs/{org_id}/update-subscription",
        endpoint=update_subscription,
        methods=["POST"],
    ),
    RouteConfig(
        name='create_customer_portal_session',
        path="/orgs/{org_id}/customer-portal",
        endpoint=create_customer_portal_session,
        methods=["POST"],
    ),
    RouteConfig(
        name='get_stripe_pricing',
        path="/orgs/{org_id}/stripe-pricing",
        endpoint=get_stripe_pricing,
        methods=["GET"],
    ),
    RouteConfig(
        name='preview_member_add_cost',
        path="/orgs/{org_id}/preview-member-cost",
        endpoint=preview_member_add_cost,
        methods=["GET"],
    ),
    RouteConfig(
        name='revoke_org_invite',
        path="/orgs/{org_id}/invites/{email}",
        endpoint=revoke_org_invite,
        methods=["DELETE"],
    ),
    # Project routes
    RouteConfig(
        name='get_projects',
        path="/projects",
        endpoint=get_projects,
        methods=["GET"],
    ),
    RouteConfig(
        name='get_project',
        path="/projects/{project_id}",
        endpoint=get_project,
        methods=["GET"],
    ),
    RouteConfig(
        name='create_project',
        path="/projects",
        endpoint=create_project,
        methods=["POST"],
    ),
    RouteConfig(
        name='update_project',
        path="/projects/{project_id}/update",
        endpoint=update_project,
        methods=["POST"],
    ),
    RouteConfig(
        name='delete_project',
        path="/projects/{project_id}/delete",
        endpoint=delete_project,
        methods=["POST"],
    ),
    RouteConfig(
        name='regenerate_api_key',
        path="/projects/{project_id}/regenerate-key",
        endpoint=regenerate_api_key,
        methods=["POST"],
    ),
    # Billing routes
    RouteConfig(
        name='get_billing_dashboard',
        path="/orgs/{org_id}/billing/dashboard",
        endpoint=BillingDashboardView,
        methods=["GET"],
    ),
]
