/*
 * Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibWeb/CSS/CSSTransformComponent.h>

namespace Web::CSS {

// https://drafts.css-houdini.org/css-typed-om-1/#cssskew
class CSSSkew final : public CSSTransformComponent {
    WEB_PLATFORM_OBJECT(CSSSkew, CSSTransformComponent);
    GC_DECLARE_ALLOCATOR(CSSSkew);

public:
    [[nodiscard]] static GC::Ref<CSSSkew> create(JS::Realm&, GC::Ref<CSSNumericValue> ax, GC::Ref<CSSNumericValue> ay);
    static WebIDL::ExceptionOr<GC::Ref<CSSSkew>> construct_impl(JS::Realm&, GC::Ref<CSSNumericValue> ax, GC::Ref<CSSNumericValue> ay);

    virtual ~CSSSkew() override;

    virtual WebIDL::ExceptionOr<Utf16String> to_string() const override;

    virtual WebIDL::ExceptionOr<GC::Ref<Geometry::DOMMatrix>> to_matrix() const override;

    GC::Ref<CSSNumericValue> ax() const { return m_ax; }
    GC::Ref<CSSNumericValue> ay() const { return m_ay; }
    WebIDL::ExceptionOr<void> set_ax(GC::Ref<CSSNumericValue> value);
    WebIDL::ExceptionOr<void> set_ay(GC::Ref<CSSNumericValue> value);

    virtual void set_is_2d(bool value) override;

    virtual WebIDL::ExceptionOr<NonnullRefPtr<TransformationStyleValue const>> create_style_value(PropertyNameAndID const&) const override;

private:
    explicit CSSSkew(JS::Realm&, GC::Ref<CSSNumericValue> ax, GC::Ref<CSSNumericValue> ay);

    virtual void initialize(JS::Realm&) override;
    virtual void visit_edges(Visitor&) override;

    GC::Ref<CSSNumericValue> m_ax;
    GC::Ref<CSSNumericValue> m_ay;
};

}
