selfprivacy.org.app/lib/logic/models/job.dart

48 lines
1.1 KiB
Dart
Raw Normal View History

2021-05-26 00:53:54 +03:00
import 'package:equatable/equatable.dart';
2021-06-08 21:52:44 +03:00
import 'package:flutter/material.dart';
2021-08-18 13:44:46 +03:00
import 'package:selfprivacy/logic/common_enum/common_enum.dart';
2021-08-18 12:36:40 +03:00
import 'package:selfprivacy/utils/password_generator.dart';
2021-08-18 13:44:46 +03:00
import 'package:easy_localization/easy_localization.dart';
2021-05-26 00:53:54 +03:00
2021-08-29 18:02:51 +03:00
import 'user.dart';
2021-06-08 21:52:44 +03:00
@immutable
2021-05-26 00:53:54 +03:00
class Job extends Equatable {
Job({
String? id,
required this.title,
2021-08-18 12:36:40 +03:00
}) : id = id ?? StringGenerators.simpleId();
2021-05-26 00:53:54 +03:00
final String title;
final String id;
@override
List<Object> get props => [id, title];
}
2021-06-08 21:52:44 +03:00
class CreateUserJob extends Job {
CreateUserJob({
required this.user,
2021-08-18 13:44:46 +03:00
}) : super(title: '${"jobs.createUser".tr()} ${user.login}');
2021-06-08 21:52:44 +03:00
final User user;
@override
2021-08-29 18:02:51 +03:00
List<Object> get props => [id, title, user];
2021-06-08 21:52:44 +03:00
}
2021-08-18 13:44:46 +03:00
class ServiceToggleJob extends Job {
ServiceToggleJob({
required this.type,
required this.needToTurnOn,
2021-08-29 18:02:51 +03:00
}) : super(
title:
'${needToTurnOn ? "jobs.serviceTurnOn".tr() : "jobs.serviceTurnOff".tr()} ${type.title}');
2021-08-18 13:44:46 +03:00
final ServiceTypes type;
final bool needToTurnOn;
@override
2021-08-29 18:02:51 +03:00
List<Object> get props => [id, title, type, needToTurnOn];
2021-08-18 13:44:46 +03:00
}