// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef IOS_CHROME_BROWSER_SIGNIN_MODEL_CONSTANTS_H_
#define IOS_CHROME_BROWSER_SIGNIN_MODEL_CONSTANTS_H_

#import <Foundation/Foundation.h>

#import "base/containers/enum_set.h"

@class SceneState;

namespace signin_ui {
enum class CancelationReason;
}  // namespace signin_ui

// The key in the user info dictionary containing the GoogleServiceAuthError
// code.
extern NSString* const kGoogleServiceAuthErrorState;

// Error domain for SystemIdentityManager errors.
extern NSString* const kSystemIdentityManagerErrorDomain;

// Error code for `kSystemIdentityManagerErrorDomain`.
enum class SystemIdentityManagerErrorCode : NSInteger {
  kNoAuthenticatedIdentity = 0,
  kClientIDMismatch = 1,
  kInvalidTokenIdentity = 2,
};

// Error domain for authentication error.
extern NSString* const kAuthenticationErrorDomain;

// Error code for `kAuthenticationErrorDomain`.
typedef enum {
  AUTHENTICATION_FLOW_ERROR = -206,
  TIMED_OUT_FETCH_POLICY = -210,
} AuthenticationErrorCode;

// Enum is used to represent the action to be taken by the authentication once
// the user is successfully signed in.
enum class PostSignInAction {
  // Shows a snackbar displaying the account that just signed-in.
  kShowSnackbar,
  kFirstType = kShowSnackbar,
  // Shows a snackbar to confirm the account that was just switched to.
  kShowIdentityConfirmationSnackbar,
  // Enables SelectableType::kBookmarks for the account that just signed-in from
  // the bookmarks manager.
  kEnableUserSelectableTypeBookmarks,
  // Enables SelectableType::kReadingList for the account that just signed-in
  // from the reading list manager.
  kEnableUserSelectableTypeReadingList,
  // Shows the history sync screen after a profile switch.
  kShowHistorySyncScreenAfterProfileSwitch,
  kLastType = kShowHistorySyncScreenAfterProfileSwitch
};

using PostSignInActionSet = base::EnumSet<PostSignInAction,
                                          PostSignInAction::kFirstType,
                                          PostSignInAction::kLastType>;

// Enum for identity avatar size. See GetSizeForIdentityAvatarSize() to convert
// the enum value to point.
enum class IdentityAvatarSize {
  TableViewIcon,  // 30 pt.
  SmallSize,      // 32 pt.
  Regular,        // 40 pt.
  Large,          // 48 pt.
};

// How to draw the AI Ring.
enum class AITierRingSize {
  // There are no rings.
  kNoRing,
  // Always keep the avatar image size the same, the avatar view can become
  // bigger if the ring is added.
  kImageSize,
  // Always keep the avatar view the same, the avatar image can become smaller
  // if the ring is added
  kViewSize,
};

// The width of the AI tier ring.
inline constexpr CGFloat kAiTierRingWidth = 3.0;
// The margin between the identity disc and the AI tier ring.
inline constexpr CGFloat kAiTierAndAvatarDistance = 2.0;

namespace signin_ui {

// Completion callback for a sign-in operation.
// `success` is YES if the operation was successful.
using SigninCompletionCallback = void (^)(CancelationReason cancelationReason);

// Completion callback for a sign-out operation.
// `success` is YES if the operation was successful.
using SignoutCompletionCallback = void (^)(BOOL success,
                                           SceneState* scene_state);

}  // namespace signin_ui

// Accessibility identifier for the premium avatar ring.
extern NSString* const kPremiumAvatarRingAccessibilityIdentifier;

#endif  // IOS_CHROME_BROWSER_SIGNIN_MODEL_CONSTANTS_H_
