Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Maps / Tizen.Maps / PlaceReview.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18
19 namespace Tizen.Maps
20 {
21     /// <summary>
22     /// Place Review information, used in Place Discovery and Search requests
23     /// </summary>
24     /// <since_tizen>3</since_tizen>
25     public class PlaceReview
26     {
27         private DateTime _date;
28         private string _title;
29         private double _rating;
30         private string _description;
31         private string _language;
32         private PlaceMedia _media;
33         private PlaceLink _userLink;
34
35         internal PlaceReview(Interop.PlaceReviewHandle handle)
36         {
37             string date = handle.Date;
38             if (DateTime.TryParse(date, out _date) == false)
39             {
40                 Interop.ErrorCode.InvalidParameter.WarnIfFailed($"Wrong date format: {date}");
41             }
42
43             _title = handle.Title;
44             _rating = handle.Rating;
45             _description = handle.Description;
46             _language = handle.Language;
47             _media = new PlaceMedia(handle.Media);
48             _userLink = new PlaceLink(handle.User);
49         }
50
51         /// <summary>
52         /// Gets an instance of <see cref="DateTime"/> object which representing time of this review.
53         /// </summary>
54         /// <since_tizen>3</since_tizen>
55         public DateTime Date { get { return _date; } }
56
57         /// <summary>
58         /// Gets a string which representing title of this review.
59         /// </summary>
60         /// <since_tizen>3</since_tizen>
61         public string Title { get { return _title; } }
62
63         /// <summary>
64         /// Gets a value which representing rating of this review.
65         /// </summary>
66         /// <since_tizen>3</since_tizen>
67         public double Rating { get { return _rating; } }
68
69         /// <summary>
70         /// Gets a string which representing description of this review.
71         /// </summary>
72         /// <since_tizen>3</since_tizen>
73         public string Description { get { return _description; } }
74
75         /// <summary>
76         /// Gets a string which representing language of this review.
77         /// </summary>
78         /// <since_tizen>3</since_tizen>
79         public string Language { get { return _language; } }
80
81         /// <summary>
82         /// Gets an instance of <see cref="PlaceMedia"/> object which representing review media of this review.
83         /// </summary>
84         /// <since_tizen>3</since_tizen>
85         public PlaceMedia ReviewMedia { get { return _media; } }
86
87         /// <summary>
88         /// Gets an instance of <see cref="PlaceLink"/> object which representing user link of this review.
89         /// </summary>
90         /// <since_tizen>3</since_tizen>
91         public PlaceLink UserLink { get { return _userLink; } }
92     }
93 }