cocina-models 0.29.0 → 0.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +51 -0
  3. data/.github/pull_request_template.md +8 -1
  4. data/.rubocop.yml +14 -3
  5. data/README.md +21 -13
  6. data/cocina-models.gemspec +6 -1
  7. data/docs/index.html +20 -0
  8. data/docs/maps/DRO.json +1 -1
  9. data/exe/generator +9 -0
  10. data/lib/cocina/generator.rb +7 -0
  11. data/lib/cocina/generator/generator.rb +80 -0
  12. data/lib/cocina/generator/schema.rb +105 -0
  13. data/lib/cocina/generator/schema_array.rb +24 -0
  14. data/lib/cocina/generator/schema_base.rb +71 -0
  15. data/lib/cocina/generator/schema_ref.rb +16 -0
  16. data/lib/cocina/generator/schema_value.rb +38 -0
  17. data/lib/cocina/generator/vocab.rb +63 -0
  18. data/lib/cocina/models.rb +54 -25
  19. data/lib/cocina/models/access.rb +14 -0
  20. data/lib/cocina/models/admin_policy.rb +13 -56
  21. data/lib/cocina/models/admin_policy_administrative.rb +11 -0
  22. data/lib/cocina/models/administrative.rb +14 -0
  23. data/lib/cocina/models/applies_to.rb +9 -0
  24. data/lib/cocina/models/catalog_link.rb +4 -1
  25. data/lib/cocina/models/collection.rb +21 -31
  26. data/lib/cocina/models/collection_identification.rb +9 -0
  27. data/lib/cocina/models/contributor.rb +14 -0
  28. data/lib/cocina/models/description.rb +16 -7
  29. data/lib/cocina/models/descriptive_admin_metadata.rb +12 -0
  30. data/lib/cocina/models/descriptive_basic_value.rb +21 -0
  31. data/lib/cocina/models/descriptive_structured_value.rb +9 -0
  32. data/lib/cocina/models/descriptive_value.rb +23 -0
  33. data/lib/cocina/models/descriptive_value_required.rb +23 -0
  34. data/lib/cocina/models/dro.rb +34 -70
  35. data/lib/cocina/models/dro_access.rb +22 -0
  36. data/lib/cocina/models/dro_structural.rb +14 -0
  37. data/lib/cocina/models/embargo.rb +16 -0
  38. data/lib/cocina/models/event.rb +15 -0
  39. data/lib/cocina/models/file.rb +20 -36
  40. data/lib/cocina/models/file_administrative.rb +10 -0
  41. data/lib/cocina/models/file_set.rb +8 -15
  42. data/lib/cocina/models/file_set_structural.rb +9 -0
  43. data/lib/cocina/models/geographic.rb +10 -0
  44. data/lib/cocina/models/identification.rb +11 -0
  45. data/lib/cocina/models/message_digest.rb +17 -0
  46. data/lib/cocina/models/presentation.rb +12 -0
  47. data/lib/cocina/models/release_tag.rb +12 -7
  48. data/lib/cocina/models/request_admin_policy.rb +15 -3
  49. data/lib/cocina/models/request_collection.rb +21 -4
  50. data/lib/cocina/models/request_dro.rb +32 -11
  51. data/lib/cocina/models/request_dro_structural.rb +13 -0
  52. data/lib/cocina/models/request_file.rb +15 -6
  53. data/lib/cocina/models/request_file_set.rb +7 -9
  54. data/lib/cocina/models/request_file_set_structural.rb +9 -0
  55. data/lib/cocina/models/request_identification.rb +11 -0
  56. data/lib/cocina/models/sequence.rb +3 -5
  57. data/lib/cocina/models/source.rb +14 -0
  58. data/lib/cocina/models/validator.rb +28 -0
  59. data/lib/cocina/models/version.rb +1 -1
  60. data/lib/cocina/models/vocab.rb +45 -60
  61. data/openapi.yml +1003 -0
  62. metadata +116 -19
  63. data/.travis.yml +0 -23
  64. data/docs/README.md +0 -9
  65. data/docs/_config.yml +0 -1
  66. data/docs/meta.json +0 -9
  67. data/docs/schema.json +0 -1654
  68. data/docs/schema.md +0 -268
  69. data/lib/cocina/models/admin_policy_attributes.rb +0 -21
  70. data/lib/cocina/models/collection_attributes.rb +0 -22
  71. data/lib/cocina/models/dro_attributes.rb +0 -22
  72. data/lib/cocina/models/file_attributes.rb +0 -25
  73. data/lib/cocina/models/file_set_attributes.rb +0 -16
  74. data/lib/cocina/models/types.rb +0 -10
@@ -2,9 +2,12 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- # Metadata for a catalog link
6
5
  class CatalogLink < Struct
6
+ # Catalog that is the source of the linked record.
7
+ # example: symphony
7
8
  attribute :catalog, Types::Strict::String
9
+ # Record identifier that is unique within the context of the linked record's catalog.
10
+ # example: 11403803
8
11
  attribute :catalogRecordId, Types::Strict::String
9
12
  end
10
13
  end
@@ -2,43 +2,33 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- # A digital repository collection.
6
- # See http://sul-dlss.github.io/cocina-models/maps/Collection.json
7
5
  class Collection < Struct
8
6
  include Checkable
9
7
 
10
- TYPES = [
11
- Vocab.collection,
12
- Vocab.curated_collection,
13
- Vocab.exhibit,
14
- Vocab.series,
15
- Vocab.user_collection
16
- ].freeze
8
+ TYPES = ['http://cocina.sul.stanford.edu/models/collection.jsonld',
9
+ 'http://cocina.sul.stanford.edu/models/curated-collection.jsonld',
10
+ 'http://cocina.sul.stanford.edu/models/user-collection.jsonld',
11
+ 'http://cocina.sul.stanford.edu/models/exhibit.jsonld',
12
+ 'http://cocina.sul.stanford.edu/models/series.jsonld'].freeze
17
13
 
18
- # Subschema for access concerns
19
- class Access < Struct
20
- attribute :access, Types::String.default('dark')
21
- .enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
22
- end
23
-
24
- # Subschema for administrative concerns
25
- class Administrative < Struct
26
- attribute :releaseTags, Types::Strict::Array.of(ReleaseTag).default([].freeze)
27
- # TODO: Allowing hasAdminPolicy to be omittable for now (until rolled out to consumers),
28
- # but I think it's actually required for every Collection
29
- attribute :hasAdminPolicy, Types::Strict::String.optional.default(nil)
30
- end
31
-
32
- # Identification sub-schema for the Collection
33
- class Identification < Struct
34
- attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).meta(omittable: true)
35
- end
14
+ # The content type of the Collection. Selected from an established set of values.
15
+ # example: item
16
+ attribute :type, Types::Strict::String.enum(*Collection::TYPES)
17
+ # example: druid:bc123df4567
18
+ attribute :externalIdentifier, Types::Strict::String
19
+ # Primary processing label (can be same as title) for a Collection.
20
+ attribute :label, Types::Strict::String
21
+ # Version for the Collection within SDR.
22
+ attribute :version, Types::Strict::Integer
23
+ attribute(:access, Access.default { Access.new })
24
+ attribute :administrative, Administrative.optional.meta(omittable: true)
25
+ attribute :description, Description.optional.meta(omittable: true)
26
+ attribute :identification, CollectionIdentification.optional.meta(omittable: true)
36
27
 
37
- class Structural < Struct
28
+ def self.new(attributes = default_attributes, safe = false, validate = true, &block)
29
+ Validator.validate(self, attributes.with_indifferent_access) if validate && name
30
+ super(attributes, safe, &block)
38
31
  end
39
-
40
- include CollectionAttributes
41
- attribute :externalIdentifier, Types::Strict::String
42
32
  end
43
33
  end
44
34
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class CollectionIdentification < Struct
6
+ attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).meta(omittable: true)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class Contributor < Struct
6
+ attribute :name, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
7
+ # Entity type of the contributor (person, organization, etc.).
8
+ attribute :type, Types::Strict::String.meta(omittable: true)
9
+ # Status of the contributor relative to other parallel contributors.
10
+ attribute :status, Types::Strict::String.meta(omittable: true)
11
+ attribute :role, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
12
+ end
13
+ end
14
+ end
@@ -2,15 +2,24 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- # Descriptive metadata. See http://sul-dlss.github.io/cocina-models/maps/Description.json
6
5
  class Description < Struct
7
- # Title element. See http://sul-dlss.github.io/cocina-models/maps/Title.json
8
- class Title < Struct
9
- attribute :primary, Types::Strict::Bool
10
- attribute :titleFull, Types::Strict::String
11
- end
6
+ attribute :title, Types::Strict::Array.of(DescriptiveValueRequired).default([].freeze)
7
+ attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
8
+ attribute :event, Types::Strict::Array.of(Event).meta(omittable: true)
9
+ attribute :form, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
10
+ attribute :language, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
11
+ attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
12
+ attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
13
+ # Stanford persistent URL associated with the resource.
14
+ attribute :purl, Types::Strict::String.meta(omittable: true)
15
+ attribute :url, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
16
+ attribute :marcEncodedData, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
17
+ attribute :adminMetadata, DescriptiveAdminMetadata.optional.meta(omittable: true)
12
18
 
13
- attribute :title, Types::Strict::Array.of(Title)
19
+ def self.new(attributes = default_attributes, safe = false, validate = true, &block)
20
+ Validator.validate(self, attributes.with_indifferent_access) if validate && name
21
+ super(attributes, safe, &block)
22
+ end
14
23
  end
15
24
  end
16
25
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class DescriptiveAdminMetadata < Struct
6
+ attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
7
+ attribute :event, Types::Strict::Array.of(Event).meta(omittable: true)
8
+ attribute :language, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
9
+ attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class DescriptiveBasicValue < Struct
6
+ # String value of the descriptive element.
7
+ attribute :value, Types::Strict::String.meta(omittable: true)
8
+ # Type of value provided by the descriptive element.
9
+ attribute :type, Types::Strict::String.meta(omittable: true)
10
+ # Status of the descriptive element relative to other instances of the element.
11
+ attribute :status, Types::Strict::String.meta(omittable: true)
12
+ # Code value of the descriptive element.
13
+ attribute :code, Types::Strict::String.meta(omittable: true)
14
+ # URI value of the descriptive element.
15
+ attribute :uri, Types::Strict::String.meta(omittable: true)
16
+ attribute :standard, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
17
+ attribute :encoding, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
18
+ attribute :source, Source.optional.meta(omittable: true)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class DescriptiveStructuredValue < Struct
6
+ attribute :structuredValue, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class DescriptiveValue < Struct
6
+ # String value of the descriptive element.
7
+ attribute :value, Types::Strict::String.meta(omittable: true)
8
+ # Type of value provided by the descriptive element.
9
+ attribute :type, Types::Strict::String.meta(omittable: true)
10
+ # Status of the descriptive element relative to other instances of the element.
11
+ attribute :status, Types::Strict::String.meta(omittable: true)
12
+ # Code value of the descriptive element.
13
+ attribute :code, Types::Strict::String.meta(omittable: true)
14
+ # URI value of the descriptive element.
15
+ attribute :uri, Types::Strict::String.meta(omittable: true)
16
+ attribute :standard, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
17
+ attribute :encoding, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
18
+ attribute :source, Source.optional.meta(omittable: true)
19
+ attribute :structuredValue, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
20
+ attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class DescriptiveValueRequired < Struct
6
+ # String value of the descriptive element.
7
+ attribute :value, Types::Strict::String.meta(omittable: true)
8
+ # Type of value provided by the descriptive element.
9
+ attribute :type, Types::Strict::String.meta(omittable: true)
10
+ # Status of the descriptive element relative to other instances of the element.
11
+ attribute :status, Types::Strict::String.meta(omittable: true)
12
+ # Code value of the descriptive element.
13
+ attribute :code, Types::Strict::String.meta(omittable: true)
14
+ # URI value of the descriptive element.
15
+ attribute :uri, Types::Strict::String.meta(omittable: true)
16
+ attribute :standard, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
17
+ attribute :encoding, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
18
+ attribute :source, Source.optional.meta(omittable: true)
19
+ attribute :structuredValue, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
20
+ attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
21
+ end
22
+ end
23
+ end
@@ -2,80 +2,44 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- # A digital repository object.
6
- # See http://sul-dlss.github.io/cocina-models/maps/DRO.json
7
5
  class DRO < Struct
8
6
  include Checkable
9
7
 
10
- TYPES = [
11
- Vocab.object,
12
- Vocab.three_dimensional,
13
- Vocab.agreement,
14
- Vocab.book,
15
- Vocab.document,
16
- Vocab.geo,
17
- Vocab.image,
18
- Vocab.page,
19
- Vocab.photograph,
20
- Vocab.manuscript,
21
- Vocab.map,
22
- Vocab.media,
23
- Vocab.track,
24
- Vocab.webarchive_binary,
25
- Vocab.webarchive_seed
26
- ].freeze
27
-
28
- # Subschema for access concerns
29
- class Access < Struct
30
- # Subschema for embargo concerns
31
- class Embargo < Struct
32
- attribute :releaseDate, Types::Params::DateTime
33
- attribute :access, Types::String.default('dark')
34
- .enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
35
- attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
36
- end
37
-
38
- attribute :access, Types::String.default('dark')
39
- .enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
40
- attribute :copyright, Types::Strict::String.meta(omittable: true)
41
- attribute :embargo, Embargo.optional.meta(omittable: true)
42
- attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
43
- end
44
-
45
- # Subschema for administrative concerns
46
- class Administrative < Struct
47
- # TODO: Allowing hasAdminPolicy to be omittable for now (until rolled out to consumers),
48
- # but I think it's actually required for every DRO
49
- attribute :hasAdminPolicy, Types::Strict::String.optional.default(nil)
50
- attribute :releaseTags, Types::Strict::Array.of(ReleaseTag).meta(omittable: true).default([].freeze)
51
- attribute :partOfProject, Types::Strict::String.meta(omittable: true)
52
- end
53
-
54
- # Identification sub-schema for the DRO
55
- class Identification < Struct
56
- attribute :sourceId, Types::Strict::String.meta(omittable: true)
57
- attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).meta(omittable: true)
58
- end
59
-
60
- # Geographic sub-schema for the DRO
61
- class Geographic < Struct
62
- attribute :iso19139, Types::Strict::String
63
- end
64
-
65
- # Structural sub-schema for the DRO (uses FileSet, unlike RequestDRO which uses RequestFileSet)
66
- class Structural < Struct
67
- attribute :contains, Types::Strict::Array.of(FileSet).meta(omittable: true)
68
- attribute :hasAgreement, Types::Strict::String.meta(omittable: true)
69
- attribute :isMemberOf, Types::Strict::String.meta(omittable: true)
70
- attribute :hasMemberOrders, Types::Strict::Array.of(Sequence).meta(omittable: true)
71
- end
72
-
73
- include DroAttributes
8
+ TYPES = ['http://cocina.sul.stanford.edu/models/object.jsonld',
9
+ 'http://cocina.sul.stanford.edu/models/3d.jsonld',
10
+ 'http://cocina.sul.stanford.edu/models/agreement.jsonld',
11
+ 'http://cocina.sul.stanford.edu/models/book.jsonld',
12
+ 'http://cocina.sul.stanford.edu/models/document.jsonld',
13
+ 'http://cocina.sul.stanford.edu/models/geo.jsonld',
14
+ 'http://cocina.sul.stanford.edu/models/image.jsonld',
15
+ 'http://cocina.sul.stanford.edu/models/page.jsonld',
16
+ 'http://cocina.sul.stanford.edu/models/photograph.jsonld',
17
+ 'http://cocina.sul.stanford.edu/models/manuscript.jsonld',
18
+ 'http://cocina.sul.stanford.edu/models/map.jsonld',
19
+ 'http://cocina.sul.stanford.edu/models/media.jsonld',
20
+ 'http://cocina.sul.stanford.edu/models/track.jsonld',
21
+ 'http://cocina.sul.stanford.edu/models/webarchive-binary.jsonld',
22
+ 'http://cocina.sul.stanford.edu/models/webarchive-seed.jsonld'].freeze
23
+
24
+ # The content type of the DRO. Selected from an established set of values.
25
+ # example: item
26
+ attribute :type, Types::Strict::String.enum(*DRO::TYPES)
27
+ # example: druid:bc123df4567
74
28
  attribute :externalIdentifier, Types::Strict::String
75
- attribute(:structural, Structural.default { Structural.new })
76
-
77
- def image?
78
- type == Vocab.image
29
+ # Primary processing label (can be same as title) for a DRO.
30
+ attribute :label, Types::Strict::String
31
+ # Version for the DRO within SDR.
32
+ attribute :version, Types::Strict::Integer
33
+ attribute(:access, DROAccess.default { DROAccess.new })
34
+ attribute :administrative, Administrative.optional.meta(omittable: true)
35
+ attribute :description, Description.optional.meta(omittable: true)
36
+ attribute :identification, Identification.optional.meta(omittable: true)
37
+ attribute :structural, DROStructural.optional.meta(omittable: true)
38
+ attribute :geographic, Geographic.optional.meta(omittable: true)
39
+
40
+ def self.new(attributes = default_attributes, safe = false, validate = true, &block)
41
+ Validator.validate(self, attributes.with_indifferent_access) if validate && name
42
+ super(attributes, safe, &block)
79
43
  end
80
44
  end
81
45
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class DROAccess < Struct
6
+ attribute :access, Types::Strict::String.default('dark').enum('world', 'stanford', 'location-based', 'citation-only', 'dark').meta(omittable: true)
7
+ # The human readable copyright statement that applies
8
+ # example: Copyright World Trade Organization
9
+ attribute :copyright, Types::Strict::String.meta(omittable: true)
10
+ attribute :embargo, Embargo.optional.meta(omittable: true)
11
+ # Download access level. This is used in the transition from Fedora as a way to set a default download level at registration that is copied down to all the files.
12
+
13
+ attribute :download, Types::Strict::String.default('none').enum('world', 'stanford', 'location-based', 'none').meta(omittable: true)
14
+ # If access is "location-based", which location should have access. This is used in the transition from Fedora as a way to set a default readLocation at registration that is copied down to all the files.
15
+
16
+ attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
17
+ # The human readable use and reproduction statement that applies
18
+ # example: Property rights reside with the repository. Literary rights reside with the creators of the documents or their heirs. To obtain permission to publish or reproduce, please contact the Public Services Librarian of the Dept. of Special Collections (http://library.stanford.edu/spc).
19
+ attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class DROStructural < Struct
6
+ attribute :contains, Types::Strict::Array.of(FileSet).meta(omittable: true)
7
+ attribute :hasMemberOrders, Types::Strict::Array.of(Sequence).meta(omittable: true)
8
+ # example: druid:bc123df4567
9
+ attribute :isMemberOf, Types::Strict::String.meta(omittable: true)
10
+ # Agreement that covers the deposit of the DRO into SDR.
11
+ attribute :hasAgreement, Types::Strict::String.meta(omittable: true)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class Embargo < Struct
6
+ # Date when the Collection is released from an embargo.
7
+ # example: 2029-06-22T07:00:00.000+00:00
8
+ attribute :releaseDate, Types::Params::DateTime
9
+ # Access level that applies when embargo expires.
10
+ attribute :access, Types::Strict::String.enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
11
+ # The human readable use and reproduction statement that applies when the embargo expires.
12
+ # example: These materials are in the public domain.
13
+ attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class Event < Struct
6
+ attribute :structuredValue, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
7
+ # Description of the event (creation, publication, etc.).
8
+ attribute :type, Types::Strict::String.meta(omittable: true)
9
+ attribute :date, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
10
+ attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
11
+ attribute :location, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
12
+ attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
13
+ end
14
+ end
15
+ end
@@ -2,47 +2,31 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- # Metadata for a file.
6
- # See http://sul-dlss.github.io/cocina-models/maps/File.json
7
5
  class File < Struct
8
6
  include Checkable
9
7
 
10
- TYPES = [
11
- Vocab.file
12
- ].freeze
8
+ TYPES = ['http://cocina.sul.stanford.edu/models/file.jsonld'].freeze
13
9
 
14
- # Represents access controls on the file
15
- class Access < Struct
16
- attribute :access, Types::String.default('dark')
17
- .enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
18
- end
19
-
20
- # Represents the administration of the file
21
- class Administrative < Struct
22
- attribute :sdrPreserve, Types::Strict::Bool.optional.default(true)
23
- attribute :shelve, Types::Strict::Bool.optional.default(false)
24
- end
25
-
26
- # Represents a digest (checksum) value for a file
27
- class Fixity < Struct
28
- attribute :type, Types::String.enum('md5', 'sha1')
29
- attribute :digest, Types::Strict::String
30
- end
31
-
32
- class Identification < Struct
33
- end
34
-
35
- # Represents some technical aspect of the file
36
- class Presentation < Struct
37
- attribute :height, Types::Strict::Integer.optional.default(nil)
38
- attribute :width, Types::Strict::Integer.optional.default(nil)
39
- end
40
-
41
- class Structural < Struct
42
- end
43
-
44
- include FileAttributes
10
+ # The content type of the File.
11
+ attribute :type, Types::Strict::String.enum(*File::TYPES)
12
+ # Identifier for the resource within the SDR architecture but outside of the repository. UUID. Constant across resource versions. What clients will use calling the repository.
45
13
  attribute :externalIdentifier, Types::Strict::String
14
+ # Primary processing label (can be same as title) for a File.
15
+ attribute :label, Types::Strict::String
16
+ # Filename for a file. Can be same as label.
17
+ attribute :filename, Types::Strict::String
18
+ # Size of the File (binary) in bytes.
19
+ attribute :size, Types::Strict::Integer.meta(omittable: true)
20
+ # Version for the File within SDR.
21
+ attribute :version, Types::Strict::Integer
22
+ # MIME Type of the File.
23
+ attribute :hasMimeType, Types::Strict::String.meta(omittable: true)
24
+ # Use for the File.
25
+ attribute :use, Types::Strict::String.meta(omittable: true)
26
+ attribute :hasMessageDigests, Types::Strict::Array.of(MessageDigest).default([].freeze)
27
+ attribute(:access, Access.default { Access.new })
28
+ attribute(:administrative, FileAdministrative.default { FileAdministrative.new })
29
+ attribute :presentation, Presentation.optional.meta(omittable: true)
46
30
  end
47
31
  end
48
32
  end