//
//	Copyright (c) 2018-present, Square, Inc. All rights reserved.
//
//	Your use of this software is subject to the Square Developer Terms of
//	Service (https://squareup.com/legal/developers). This copyright notice shall
//	be included in all copies or substantial portions of the software.
//
//	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//	THE SOFTWARE.
//

@import Foundation;

@class SQRDMoney;
@class SQRDTender;

/**
 The result of the checkout flow.
 */
@interface SQRDCheckoutResult : NSObject <NSCopying>

/**
 A unique ID issued by Square servers for successful transactions that include one or more card tenders.
 
 The transaction ID is `nil` for transactions that have no card tenders (for example, a cash transaction).
 Transaction IDs can be used to look up transaction details or refund transactions via the [Transactions API]
 (https://docs.connect.squareup.com/api/connect/v2/#navsection-transactions).
 */
@property (nonatomic, readonly, nullable) NSString *transactionID;

/**
 A unique client-generated ID for successful transactions.

 All successful transactions include a client-generated ID. Transactions with card  
 tenders also include a `transactionID` that is assigned when the card is processed.

 To reconcile transactions that do not have card tenders, use `transactionClientID` to match
 client-generated transactions to the `client_id` field in transactions returned by the [ListTransactions]
 (https://docs.connect.squareup.com/api/connect/v2#endpoint-listtransactions) endpoint of the Transactions API.
*/
@property (nonatomic, readonly, nonnull) NSString *transactionClientID;

/**
 The unique ID of the location to which the transaction was credited.
 
 Location IDs are generated by Square for store locations listed in Square
 Dashboard, and can be accessed through the [Locations API]
 (https://docs.connect.squareup.com/api/connect/v2/#navsection-transactions).
 */
@property (nonatomic, readonly, nonnull) NSString *locationID;

/**
 The date and time when the transaction was completed as determined by the client device.
 */
@property (nonatomic, readonly, nonnull) NSDate *createdAt;

/**
 The total amount of money collected during checkout.
 
 This is the sum of the `totalMoney` amounts for all `tenders`, including tips.
 */
@property (nonatomic, readonly, nonnull) SQRDMoney *totalMoney;

/**
 The total tip amount applied across all tenders.
 
 Included as part of `totalMoney`.
 */
@property (nonatomic, readonly, nonnull) SQRDMoney *totalTipMoney;

/**
 The set of tenders associated with a successful transaction.
*/
@property (nonatomic, readonly, nonnull) NSSet<SQRDTender *> *tenders;

#pragma mark - NSObject

/**
 :nodoc:
 Returns a Boolean value that indicates whether the receiver and a given SQRDCheckoutResult are equal.
 */
- (BOOL)isEqual:(nullable SQRDCheckoutResult *)object;

/**
 :nodoc:
 Returns an integer that can be used as a table address in a hash table structure.
 */
@property (readonly) NSUInteger hash;

/** :nodoc: */
- (nonnull instancetype)init NS_UNAVAILABLE;

/** :nodoc: */
+ (nonnull instancetype) new NS_UNAVAILABLE;


@end
