415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell/*
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * The contents of this file are subject to the terms of the Common Development and
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Distribution License (the License). You may not use this file except in compliance with the
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * License.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell *
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * specific language governing permission and limitations under the License.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell *
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * When distributing Covered Software, include this CDDL Header Notice in each file and include
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Header, with the fields enclosed by brackets [] replaced by your own identifying
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * information: "Portions copyright [year] [name of copyright owner]".
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell *
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Copyright 2016 ForgeRock AS.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell */
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell@class FRAIdentityDatabase;
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni@class FRAIdentityModel;
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell/*!
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Base class for Authenticator data model types.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell */
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni@interface FRAModelObject : NSObject {
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni @protected
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni FRAIdentityModel *_identityModel;
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni}
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell/*!
55abfb9b58693eddac5205e74aac84f50c9798d2Robert Wapshott * Indicates whether this model object has been persisted to the database.
55abfb9b58693eddac5205e74aac84f50c9798d2Robert Wapshott * YES indicates it has been stored, NO indicates it has not yet been stored.
55abfb9b58693eddac5205e74aac84f50c9798d2Robert Wapshott *
55abfb9b58693eddac5205e74aac84f50c9798d2Robert Wapshott * NB: This property only indicates whether or not a record has been persisted. It
55abfb9b58693eddac5205e74aac84f50c9798d2Robert Wapshott * does not indicate whether or not this object is dirty and has unsaved changes.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell */
55abfb9b58693eddac5205e74aac84f50c9798d2Robert Wapshott@property (nonatomic, readonly, getter=isStored) BOOL stored;
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell#pragma mark -
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell#pragma mark Lifecycle
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell// TODO: Create FRAModelObjectSubclass.h private header file that includes protected database property and init methods?
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell/*!
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Prevent use of default init method.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell */
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell- (instancetype)init __unavailable;
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell/*!
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Init method.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell *
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @param database The database to which this object can be persisted.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param identityModel The identity model which contains the list of identities.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @return The initialized object or nil if initialization failed.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell */
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni- (instancetype)initWithDatabase:(FRAIdentityDatabase *)database identityModel:(FRAIdentityModel *)identityModel;
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell@end