export class BaseResourceValidator {
    validate(url) {
        if (!url || typeof url !== 'string') {
            return { valid: false, error: 'URL must be a non-empty string' };
        }
        const trimmed = url.trim();
        if (!this.urlPattern.test(trimmed)) {
            return {
                valid: false,
                error: `URL does not match expected pattern for ${this.constructor.name}`,
            };
        }
        return { valid: true };
    }
    async ping(url) {
        try {
            const response = await fetch(url, {
                method: 'HEAD',
                signal: AbortSignal.timeout(5000),
            });
            return response.ok;
        }
        catch {
            return false;
        }
    }
    formatUrl(rawInput) {
        return rawInput.trim().replace(/\/+$/, '');
    }
}
export class GitHubResourceValidator extends BaseResourceValidator {
    constructor() {
        super(...arguments);
        this.urlPattern = /^https:\/\/github\.com\/[\w.-]+\/[\w.-]+/;
        this.baseUrl = 'https://github.com';
    }
}
export class JiraResourceValidator extends BaseResourceValidator {
    constructor() {
        super(...arguments);
        this.urlPattern = /^https?:\/\/[\w.-]+\.atlassian\.net\//;
        this.baseUrl = '';
    }
}
export class AzureDevOpsResourceValidator extends BaseResourceValidator {
    constructor() {
        super(...arguments);
        this.urlPattern = /^https:\/\/dev\.azure\.com\/[\w.-]+/;
        this.baseUrl = 'https://dev.azure.com';
    }
}
//# sourceMappingURL=resource-base.js.map