/*
 * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* propertyTypeReplacements */

[Entity=Interface]
interface Resource {
    [Optional]
    attribute sequence<String> params;
};

[Entity=Interface]
interface RectOptions {
    [Optional]
    attribute (number or String or sequence<(number or String)>) radius;
};

[Entity=Interface]
interface PluginComponentOptions {
    attribute String data;
};

[Entity=Interface]
interface SliderBlockStyle {
    [Optional]
    attribute String shape;
};

[Entity=Interface]
interface AlertDialogParam {
    [Optional]
    attribute TextStyle_alert_dialog textStyle;
};

[Entity=Interface]
interface BorderImageOption {
    [Optional]
    attribute (String or Resource or LinearGradient_common) source;
};

[Synthetic, Entity=Tuple]
interface AnimationRange_Number {
    attribute number value0;
    attribute number value1;
};

[Entity=Interface]
interface ContextMenuAnimationOptions {
    [Optional]
    attribute AnimationRange_Number scale;
    [Optional]
    attribute AnimationRange_Number hoverScale;
};

[Entity=Interface]
interface BaseEvent {
    attribute i64 timestamp;
};

[Entity=Interface]
interface HistoricalPoint {
    attribute i64 timestamp;
};

[Entity=Interface]
interface KeyEvent {
    attribute i64 timestamp;
};

[Entity=Interface]
interface CrownEvent {
    attribute i64 timestamp;
};

[Entity=Interface]
interface FormInfo {
    attribute (i64 or String) id;
};

[Entity=Interface]
interface FormCallbackInfo {
    attribute i64 id;
};

[Entity=Interface]
interface CustomDialogControllerOptions {
    attribute CustomDialogControllerBuilder builder;
};

/* parameterTypeReplacements */

[Entity=Class]
interface AnimatorAttribute: [TypeArguments="AnimatorAttribute"] CommonMethod {
    AnimatorAttribute motion(SpringMotion value);
};

[Entity=Class, TypeParameters="T"]
interface ScrollableCommonMethod: [TypeArguments="T"] CommonMethod {
    T onWillScroll(optional ScrollOnWillScrollCallback handler);
    T onDidScroll(ScrollOnScrollCallback handler);
    [Deprecated]
    T onScroll(Callback_Number_Number_Void event);
};

[Entity=Class]
interface ScrollAttribute: [TypeArguments="ScrollAttribute"] ScrollableCommonMethod {
    ScrollAttribute onWillScroll(optional ScrollOnWillScrollCallback handler);
    ScrollAttribute onDidScroll(ScrollOnScrollCallback handler);
};

[Entity=Class, TypeParameters="T"]
interface CommonMethod {
    T clip(optional boolean value);
    T clip(optional boolean clip);
    T mask(optional ProgressMask value);
    T mask(optional ProgressMask mask);
    T transform(TransformationMatrix value);
};

[Entity=Class]
interface View {
    pointer create(pointer value);
};

[Synthetic]
callback FormComponentAttribute_onRouter_callback_type = void (String info);

[Entity=Class]
interface FormComponentAttribute: [TypeArguments="FormComponentAttribute"] CommonMethod {
    FormComponentAttribute onRouter(FormComponentAttribute_onRouter_callback_type callback);
};

[Entity=Class]
interface LineAttribute: [TypeArguments="LineAttribute"] CommonShapeMethod {
    LineAttribute startPoint(sequence<Length> value);
    LineAttribute endPoint(sequence<Length> value);
};

[Entity=Class]
interface PolygonAttribute: [TypeArguments="PolygonAttribute"] CommonShapeMethod {
    PolygonAttribute points(sequence<common2D.Point> value);
};

[Entity=Class]
interface PolylineAttribute: [TypeArguments="PolylineAttribute"] CommonShapeMethod {
    PolylineAttribute points(sequence<common2D.Point> value);
};

[Entity=Class]
interface RectAttribute: [TypeArguments="RectAttribute"] CommonShapeMethod {
    RectAttribute radius((number or String or sequence<(number or String)>) value);
};

[Entity=Class]
interface CanvasRenderingContext2D: CanvasRenderer {
    String toDataURL(optional String type, optional f32 quality);
};

[Entity=Class]
interface OffscreenCanvasRenderingContext2D: CanvasRenderer {
    String toDataURL(optional String type, optional f32 quality);
};

[Entity=Class, TypeParameters="T"]
interface CommonShapeMethod: [TypeArguments="T"] CommonMethod {
    T strokeDashArray(sequence<Length> value);
};

[Entity=Class]
interface ShapeAttribute: [TypeArguments="ShapeAttribute"] CommonMethod {
    ShapeAttribute strokeDashArray(sequence<Length> value);
    ShapeAttribute mesh(sequence<number> value, number column, number row);
};

[Synthetic]
callback GridAttribute_onItemDragStart_event_type = CustomBuilder (ItemDragInfo event, number itemIndex);

[Entity=Class]
interface GridAttribute: [TypeArguments="GridAttribute"] ScrollableCommonMethod {
    GridAttribute onItemDragStart(GridAttribute_onItemDragStart_event_type event);
    [Deprecated]
    GridAttribute onScroll(Callback_Number_Number_Void event);
};

[Synthetic]
callback ListAttribute_onItemDragStart_event_type = CustomBuilder (ItemDragInfo event, number itemIndex);

[Entity=Class]
interface ListAttribute: [TypeArguments="ListAttribute"] ScrollableCommonMethod {
    ListAttribute onItemDragStart(ListAttribute_onItemDragStart_event_type event);
    [Deprecated]
    ListAttribute onScroll(Callback_Number_Number_Void event);
};

[Synthetic]
callback TextTimerAttribute_onTimer_event_type = void (i64 utc, i64 elapsedTime);

[Entity=Class]
interface TextTimerAttribute: [TypeArguments="TextTimerAttribute"] CommonMethod {
    TextTimerAttribute onTimer(TextTimerAttribute_onTimer_event_type event);
};

[Entity=Class, TypeParameters="T"]
interface Indicator {
    T bottom(Length value);
};

[Entity=Class]
interface NavigationAttribute: [TypeArguments="NavigationAttribute"] CommonMethod {
    [Deprecated]
    NavigationAttribute toolBar(CustomBuilder value);
};

callback Dummy_Callback = void ();
[Entity=Class, TypeParameters="Args extends Object[]"]
interface WrappedBuilder {
    constructor(Dummy_Callback builder);
    attribute Dummy_Callback builder;
};

/////////

typedef StyledStringValue = (TextStyle_styled_string or DecorationStyle or BaselineOffsetStyle or LetterSpacingStyle or TextShadowStyle or GestureStyle or ImageAttachment or ParagraphStyle or LineHeightStyle or UrlStyle or CustomSpan or UserDataSpan or BackgroundColorStyle);

[Entity=Class]
interface CanvasRenderer: CanvasPath {
    [Optional] attribute number globalAlpha;
    [Optional] attribute String globalCompositeOperation;
    [Optional] attribute (String or number or CanvasGradient or CanvasPattern) fillStyle;
    [Optional] attribute (String or number or CanvasGradient or CanvasPattern) strokeStyle;
    [Optional] attribute String filter;
    [Optional] attribute boolean imageSmoothingEnabled;
    [Optional] attribute ImageSmoothingQuality imageSmoothingQuality;
    [Optional] attribute CanvasLineCap lineCap;
    [Optional] attribute number lineDashOffset;
    [Optional] attribute CanvasLineJoin lineJoin;
    [Optional] attribute number lineWidth;
    [Optional] attribute number miterLimit;
    [Optional] attribute number shadowBlur;
    [Optional] attribute String shadowColor;
    [Optional] attribute number shadowOffsetX;
    [Optional] attribute number shadowOffsetY;
    [Optional] attribute CanvasDirection direction;
    [Optional] attribute String font;
    [Optional] attribute CanvasTextAlign textAlign;
    [Optional] attribute CanvasTextBaseline textBaseline;
};