import { rankType } from '../../shared/protocols/rank/PtlOpen';
import { rankInfo } from '../../shared/protocols/type';
import { Rank } from './rank';


export class RankSlzd1 extends Rank {
    getType(): rankType {
        return 'slzd1';
    }
    findKey = 'ghId';

    // compare(other: rankInfo, cur: rankInfo): boolean {
    //     return cur.valArr[0] > other.valArr[0];
    // }
    // compareSort(a: rankInfo, b: rankInfo): number {
    //     return b.valArr[0] - a.valArr[0];
    // }

    // // 积分, 排名依据
    // getValArr(info: rankInfo):number|string {
    //     return info?.valArr[0] || 0
    // }
    
    async getRankList(ghid: string, { min, max }): Promise<{ rankList: rankInfo[]; myRank: rankInfo; }> {
        let data = await this.getRankData(ghid);
        let rankList = await this.getRankListRange( min, max )
        let rank = await this.getRankSortByOne(ghid)
        let score = await this.getRankScore(ghid);
        return {
            rankList: rankList,
            myRank: {
                rank,
                player: data?.player || {}, // 公会信息
                valArr: [ score ]
            }
        };
    }
}

export class RankSlzd2 extends RankSlzd1 {
    getType(): rankType {
        return 'slzd2';
    }
}

export class RankSlzd3 extends RankSlzd1 {
    getType(): rankType {
        return 'slzd3';
    }
}

export class RankSlzd4 extends RankSlzd1 {
    getType(): rankType {
        return 'slzd4';
    }
}

export class RankSlzd5 extends RankSlzd1 {
    getType(): rankType {
        return 'slzd5';
    }
}

export class RankSlzd6 extends RankSlzd1 {
    getType(): rankType {
        return 'slzd6';
    }
}