Skip to content

Commit

Permalink
Add Enums for BackgroundFill and BackgroundType
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasweimann committed May 19, 2024
1 parent ddb8e32 commit 466902c
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 13 deletions.
7 changes: 5 additions & 2 deletions src/RxTelegram.Bot/Interface/ChatBackground/BackgroundFill.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using RxTelegram.Bot.Interface.ChatBackground.Enums;
using RxTelegram.Bot.Utils.MultiType;

namespace RxTelegram.Bot.Interface.ChatBackground;

public abstract class BackgroundFill
public abstract class BackgroundFill : IMultiTypeClassByType<BackgroundFillTypes>
{
public abstract string Type { get; }
public abstract BackgroundFillTypes Type { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using RxTelegram.Bot.Interface.ChatBackground.Enums;

namespace RxTelegram.Bot.Interface.ChatBackground;

Expand All @@ -10,7 +11,7 @@ public class BackgroundFillFreeformGradient : BackgroundFill
/// <summary>
/// Type of the background fill, always “freeform_gradient”
/// </summary>
public override string Type { get; } = "freeform_gradient";
public override BackgroundFillTypes Type { get; set; } = BackgroundFillTypes.FreeformGradient;

/// <summary>
/// A list of the 3 or 4 base colors that are used to generate the freeform gradient in the RGB24 format
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using RxTelegram.Bot.Interface.ChatBackground.Enums;

namespace RxTelegram.Bot.Interface.ChatBackground;

/// <summary>
Expand All @@ -8,7 +10,7 @@ public class BackgroundFillGradient : BackgroundFill
/// <summary>
/// Type of the background fill, always “gradient”
/// </summary>
public override string Type { get; } = "gradient";
public override BackgroundFillTypes Type { get; set; } = BackgroundFillTypes.Gradient;

/// <summary>
/// Top color of the gradient in the RGB24 format
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
using RxTelegram.Bot.Interface.ChatBackground.Enums;

namespace RxTelegram.Bot.Interface.ChatBackground;

/// <summary>
/// The background is filled using the selected color.
/// </summary>
public class BackgroundFillSolid
public class BackgroundFillSolid : BackgroundFill
{
/// <summary>
/// Type of the background fill, always “solid”
/// </summary>
public string Type { get; } = "solid";
public override BackgroundFillTypes Type { get; set; } = BackgroundFillTypes.Solid;

/// <summary>
/// The color of the background fill in the RGB24 format
Expand Down
7 changes: 5 additions & 2 deletions src/RxTelegram.Bot/Interface/ChatBackground/BackgroundType.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using RxTelegram.Bot.Interface.ChatBackground.Enums;
using RxTelegram.Bot.Utils.MultiType;

namespace RxTelegram.Bot.Interface.ChatBackground;

public abstract class BackgroundType
public abstract class BackgroundType : IMultiTypeClassByType<BackgroundTypes>
{
public abstract string Type { get; }
public abstract BackgroundTypes Type { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using RxTelegram.Bot.Interface.ChatBackground.Enums;

namespace RxTelegram.Bot.Interface.ChatBackground;

/// <summary>
Expand All @@ -8,11 +10,10 @@ public class BackgroundTypeChatTheme : BackgroundType
/// <summary>
/// Type of the background, always “chat_theme”
/// </summary>
public override string Type { get; } = "chat_theme";
public override BackgroundTypes Type { get; set; } = BackgroundTypes.ChatTheme;

/// <summary>
/// Name of the chat theme, which is usually an emoji
/// </summary>
public string ThemeName { get; set; }

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using RxTelegram.Bot.Interface.ChatBackground.Enums;

namespace RxTelegram.Bot.Interface.ChatBackground;

/// <summary>
Expand All @@ -8,7 +10,7 @@ public class BackgroundTypeFill : BackgroundType
/// <summary>
/// Type of the background, always “fill”
/// </summary>
public override string Type { get; } = "fill";
public override BackgroundTypes Type { get; set; } = BackgroundTypes.Fill;

/// <summary>
/// The background fill
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RxTelegram.Bot.Interface.BaseTypes;
using RxTelegram.Bot.Interface.ChatBackground.Enums;

namespace RxTelegram.Bot.Interface.ChatBackground;

Expand All @@ -10,7 +11,7 @@ public class BackgroundTypePattern : BackgroundType
/// <summary>
/// Type of the background, always “pattern”
/// </summary>
public override string Type { get; } = "pattern";
public override BackgroundTypes Type { get; set; } = BackgroundTypes.Pattern;

/// <summary>
/// Document with the pattern
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RxTelegram.Bot.Interface.BaseTypes;
using RxTelegram.Bot.Interface.ChatBackground.Enums;

namespace RxTelegram.Bot.Interface.ChatBackground;

Expand All @@ -7,7 +8,7 @@ public class BackgroundTypeWallpaper : BackgroundType
/// <summary>
/// Type of the background, always “wallpaper”
/// </summary>
public override string Type { get; } = "wallpaper";
public override BackgroundTypes Type { get; set; } = BackgroundTypes.Wallpaper;

/// <summary>
/// Document with the wallpaper
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using RxTelegram.Bot.Utils.MultiType;

namespace RxTelegram.Bot.Interface.ChatBackground.Enums;

public enum BackgroundFillTypes
{
[ImplementationType(typeof(BackgroundFillFreeformGradient))]
FreeformGradient,

[ImplementationType(typeof(BackgroundFillGradient))]
Gradient,

[ImplementationType(typeof(BackgroundFillSolid))]
Solid
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using RxTelegram.Bot.Utils.MultiType;

namespace RxTelegram.Bot.Interface.ChatBackground.Enums;

public enum BackgroundTypes
{
[ImplementationType(typeof(BackgroundTypeChatTheme))]
ChatTheme,

[ImplementationType(typeof(BackgroundTypeFill))]
Fill,

[ImplementationType(typeof(BackgroundTypePattern))]
Pattern,

[ImplementationType(typeof(BackgroundTypeWallpaper))]
Wallpaper
}

0 comments on commit 466902c

Please sign in to comment.