1 module konnexengine.video.youtube.channel.blueprint;
2 
3 import std.uuid : UUID, sha1UUID;
4 import konnexengine.video.core.video.blueprint : Video;
5 
6 T generateStructfor(T)(T t)
7 {
8 	return t;
9 }
10 
11 struct YoutubeChannelData
12 {
13 	this(string YoutubeID, string APIKey)
14 	{
15 		this.youtubeID = YoutubeID;
16 		this.apiKey = APIKey;
17 	}
18 
19 	string youtubeID;
20 	string apiKey;
21 }
22 
23 interface ChannelInterface
24 {
25 	@property UUID id();
26 	@property string youtubeID();
27 	@property string name();
28 	@property string apiKey();
29 	@property Video[] videos();
30 }
31 
32 class Channel : ChannelInterface
33 {
34 	this()
35 	{
36 	}
37 
38 	this(string youtubeID, string apiKey)
39 	{
40 		this.c_id = sha1UUID(youtubeID, sha1UUID(apiKey));
41 		this.c_youtube_id = youtubeID;
42 		this.c_api_key = apiKey;
43 	}
44 
45 	private
46 	{
47 		UUID c_id;
48 		string c_youtube_id;
49 		string c_name;
50 		string c_api_key;
51 		Video[] c_videos;
52 
53 		YoutubeChannelData generateChannelData()
54 		{
55 
56 			auto cData = YoutubeChannelData(youtubeID(), apiKey());
57 			return cData;
58 		}
59 	}
60 
61 	YoutubeChannelData returnChannelData()
62 	{
63 		return generateChannelData();
64 	}
65 
66 	@property UUID id()
67 	{
68 		return c_id;
69 	}
70 
71 	@property UUID id(UUID input)
72 	{
73 		return c_id = input;
74 	}
75 
76 	@property string youtubeID()
77 	{
78 		return c_youtube_id;
79 	}
80 
81 	@property string youtubeID(string input)
82 	{
83 		return c_youtube_id = "" ~ input;
84 	}
85 
86 	@property string name()
87 	{
88 		return c_name;
89 	}
90 
91 	@property string name(string input)
92 	{
93 		return c_name = "" ~ input;
94 	}
95 
96 	@property string apiKey()
97 	{
98 		return c_api_key;
99 	}
100 
101 	@property string apiKey(string input)
102 	{
103 		return c_api_key = "" ~ input;
104 	}
105 
106 	@property Video[] videos()
107 	{
108 		return c_videos;
109 	}
110 
111 	@property Video[] videos(Video input)
112 	{
113 		c_videos ~= input;
114 		return c_videos;
115 	}
116 }