export const OPENING_BONUS_REMARK = '开户初始余额';
export const ADMIN_DAILY_DEPOSIT_REMARK = '管理员上分';
export const AGENT_DAILY_DEPOSIT_REMARK = '代理上分';
export function dailyDepositRemark(operator) {
    return operator === 'admin' ? ADMIN_DAILY_DEPOSIT_REMARK : AGENT_DAILY_DEPOSIT_REMARK;
}
export function resolveInitialDepositRemark(kind, custom, operator) {
    if (kind === 'daily')
        return dailyDepositRemark(operator);
    if (kind === 'opening_bonus')
        return OPENING_BONUS_REMARK;
    const trimmed = custom?.trim() ?? '';
    if (trimmed.length < 2) {
        throw new Error('INITIAL_DEPOSIT_REMARK_CUSTOM_INVALID');
    }
    return trimmed;
}
export function validateInitialDepositRemark(initialDeposit, remark, operator) {
    if (initialDeposit <= 0) {
        return { ok: true, remark: remark?.trim() ?? '' };
    }
    const r = remark?.trim();
    if (!r)
        return { ok: false, code: 'INITIAL_DEPOSIT_REMARK_REQUIRED' };
    const daily = dailyDepositRemark(operator);
    if (r === daily || r === OPENING_BONUS_REMARK)
        return { ok: true, remark: r };
    if (r.length < 2)
        return { ok: false, code: 'INITIAL_DEPOSIT_REMARK_CUSTOM_INVALID' };
    return { ok: true, remark: r };
}
