# -*- coding: utf-8 -*-
"""显示助教等级定价数据"""

import os
from pathlib import Path
from dotenv import load_dotenv
import psycopg2

def main():
    load_dotenv(Path(__file__).parent.parent / ".env")
    dsn = os.getenv("PG_DSN")
    conn = psycopg2.connect(dsn)
    
    print("cfg_assistant_level_price 数据内容:")
    print("-" * 80)
    print(f"{'level_code':<12} {'level_name':<12} {'base_course_price':<18} {'bonus_course_price':<18}")
    print("-" * 80)
    
    with conn.cursor() as cur:
        cur.execute("""
            SELECT level_code, level_name, base_course_price, bonus_course_price, description
            FROM billiards_dws.cfg_assistant_level_price
            ORDER BY level_code
        """)
        for row in cur.fetchall():
            print(f"{row[0]:<12} {row[1]:<12} {row[2]:<18} {row[3]:<18}")
    
    print("-" * 80)
    print("\n数据来源依据: DWS 数据库处理需求.md")
    print("- 初级 98元/小时")
    print("- 中级 108元/小时")
    print("- 高级 118元/小时")
    print("- 星级 138元/小时")
    print("- 附加课统一 190元/小时")
    
    conn.close()

if __name__ == "__main__":
    main()
