import { Property } from '../property.js';

export class Link extends Property {
    #href: string;

    private constructor(href: string) {
        super();

        this.#href = href;
    }

    public override equals(other: Property): boolean {
        if (!(other instanceof Link)) return false;

        return other.#href === this.#href;
    }

    public override apply(element: HTMLAnchorElement): void {
        element.href = this.#href;
    }

    public static of(href: string): Link {
        return new Link(href);
    }

    public override inspect(indent: number): string {
        return `Link { href: '${this.#href}' }`;
    }
}
